Create index pattern via Kibana API

Closes #216
This commit is contained in:
Antoine Cotten 2018-01-02 20:54:40 +01:00
parent af2fe322bb
commit 13a9c66c99
No known key found for this signature in database
GPG Key ID: EA06C9A94E2B3EA0
2 changed files with 6 additions and 5 deletions

View File

@ -31,4 +31,4 @@ script:
- sleep 30
- docker-compose logs
- curl --retry 10 --retry-delay 5 -D- http://localhost:9200/
- curl --retry 10 --retry-delay 5 -I http://localhost:5601/
- curl --retry 10 --retry-delay 5 -D- http://localhost:5601/api/status

View File

@ -115,15 +115,16 @@ about the index pattern configuration.
#### On the command line
Run this command to create a Kibana index pattern:
Create an index pattern via the Kibana API:
```console
$ curl -XPUT -D- 'http://localhost:9200/.kibana/doc/index-pattern:docker-elk' \
$ curl -XPOST -D- 'http://localhost:5601/api/saved_objects/index-pattern' \
-H 'Content-Type: application/json' \
-d '{"type": "index-pattern", "index-pattern": {"title": "logstash-*", "timeFieldName": "@timestamp"}}'
-H 'kbn-version: 6.1.0' \
-d '{"attributes":{"title":"logstash-*","timeFieldName":"@timestamp"}}'
```
This will automatically be marked as the default index pattern as soon as the Kibana UI is opened for the first time.
The created pattern will automatically be marked as the default index pattern as soon as the Kibana UI is opened for the first time.
## Configuration