Create index pattern via Kibana API

Closes #216
parent 9583c193
...@@ -31,4 +31,4 @@ script: ...@@ -31,4 +31,4 @@ script:
- sleep 90 - sleep 90
- docker-compose logs - docker-compose logs
- curl --retry 10 --retry-delay 5 -D- http://localhost:9200/ -u elastic:changeme - curl --retry 10 --retry-delay 5 -D- http://localhost:9200/ -u elastic:changeme
- curl --retry 10 --retry-delay 5 -I http://localhost:5601/ - curl --retry 10 --retry-delay 5 -D- http://localhost:5601/api/status -u kibana:changeme
...@@ -117,16 +117,17 @@ about the index pattern configuration. ...@@ -117,16 +117,17 @@ about the index pattern configuration.
#### On the command line #### On the command line
Run this command to create a Kibana index pattern: Create an index pattern via the Kibana API:
```console ```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' \ -H 'Content-Type: application/json' \
-H 'kbn-version: 6.1.0' \
-u kibana:changeme \ -u kibana:changeme \
-d '{"type": "index-pattern", "index-pattern": {"title": "logstash-*", "timeFieldName": "@timestamp"}}' -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 ## Configuration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment