-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Index pattern creation API #3709
Comments
Agreed, this would be nice to have. It would also be awesome to move the mapping parsing to the server side to improve the handling of large mappings. |
I third this. I've been banging on cURL requests to do this for the last 2 hours and I've got nothing. I will keep trying... but an initial Index Pattern creation method to run programatically from other languages would be extremely beneficial. |
yeah I too was faced with this, my solution (workaround) is similar to yours, I am writing directly to the .kibana index , essentially, in Ansible I will end up doing something like this in a post deploy task:
I don't really want to be writing to that index but I also did not want to use the Kibana HTTP flows...So I am interested doing this in a more supported manner. |
It would be great if this was automated in some fashion - we're using Elasticdump to achieve this at the moment, and it's a fairly good solution, but it requires the index to be created first 'by hand', exported, and then added to our puppet code. |
Closing in favor of #5199 |
This was closed in favor of 5199, but 5199 was dropped - any chance of getting this back ? |
Kibana 5 webpage is
I was able to add index to ES 5 with this curl -XPOST -H 'Content-Type: application/json' \
'http://localhost:9200/.kibana/index-pattern/filebeat-*' \
-d'{"title":"filebeat-*","timeFieldName":"@timestamp","notExpandable":true}' But I cannot figure out where the defaultIndex is stored.
|
You can set the
|
Hmm, was hoping to do a GET against this in 5.x.
|
Looks like you fired your first GET at elastic (port 9200) and not at Kibana. |
For kibana 6.0 using curl and jq:
|
Thanks @hobti01 ! That seems to also work for Kibana 5.6.4 |
I found that in Kibana 5.0 (and probably also 6.0), you can set a specific Setting a given ID is especially convenient for automatic Kibana deployments, as your exported Dashboards etc then will always refer to a fixed ID instead of a random one. You can do so by For example:
@hobti01's script adjusted to use a fixed ID: #!/usr/bin/env bash
# From https://github.com/elastic/kibana/issues/3709
set -euo pipefail
url="http://localhost:5601"
index_pattern="logstash-*"
id="logstash-*"
time_field="@timestamp"
# Create index pattern
# curl -f to fail on error
curl -f -XPOST -H "Content-Type: application/json" -H "kbn-xsrf: anything" \
"$url/api/saved_objects/index-pattern/$id" \
-d"{\"attributes\":{\"title\":\"$index_pattern\",\"timeFieldName\":\"$time_field\"}}"
# Make it the default index
curl -XPOST -H "Content-Type: application/json" -H "kbn-xsrf: anything" \
"$url/api/kibana/settings/defaultIndex" \
-d"{\"value\":\"$id\"}" When the ID already exists, the script will fail with |
@nh2 you can remove the pipe to jq when using a static id - thanks for the suggestion! |
Oops, right! Edited. |
If you don't want that, and want overwrite behaviour instead, use You will then get responses where the
|
I have also just written an Together with this and the above index-pattern-creation curl, I can now deploy Kibana in a fully declarative fashion without having to load anything manually into it. |
FYI, trying this against es 6.2.2 fails:
Any suggestions? |
@matthewadams it looks like you are making the request against elasticsearch without using the '.kibana' endpoint. Try making the POST directly to kibana. |
If you would prefer a method for loading dashboards and index patterns from the filesystem (for use with Chef, Puppet, Salt, etc) please vouch for it: #2310 |
@sandstrom If by "vouched", you mean put a thumbs up on the issue, I did that. :) Good to know I'm not the only one. |
It would be helpful if we could have an api to configure the initial "configure an Index pattern" page to be used to used by automation tools or scripts.
The text was updated successfully, but these errors were encountered: