Refresh mappings for index-pattern automatically

Hello,
I am looking for a way to trigger the index mapping refresh (the button below) through a script/API call/whatever

I am building a Docker image for Kibana, which also loads some visualizations, searches, dashboards and the necessary index patterns (I am using the bulk API to index the Objects in the .kibana index), which works pretty good so far. Currently I am defining all my fields with the index pattern:

{
"title": "logstash-*",
"timeFieldName": "@timestamp",
"fields": "[
{"name":"_index","type":"string","count":0,"scripted":false,"indexed":false,"analyzed":false,"doc_values":false},
{"name":"Severity.raw","type":"string","count":0,"scripted":false,"indexed":true,"analyzed":false,"doc_values":true},
...
]"
}

However this approach requires to update the Kibana container image every time we introduce a new field in the Logstash container images, because I have to add the field in the index mapping, which gets imported
Because this shall be an automated setup and because I think most of our users won´t know about Kibanas internal mapping, I am looking for a way to trigger the refresh every time Kibana starts

I know you are working on getting rid of this internal mapping, but until this feature arrives in Kibana I need a workaround. Manually clicking on refresh is not an option

BR

Unfortunately, there isn't a great way to do this right now. Eventually we'd like to expose an API for this, but it's not exposed at the moment.

There's also an issue on GitHub you can follow for updates: https://github.com/elastic/kibana/issues/6498

I saw that Issue already. Do you have any idea, when something in this direction could end in the final product? sometime in 5.x, 6.x, 7.x?

From what I have seen, it shouldn't be too hard to implement this as a plugin (even considering I have no experience with Javascript at all). All I would have to do is to call the refreshIndex() function, if a certain URL is hit.
A simple Implementation like this, would actually solve some peoples problems and should be doable in a day or so. I don't think I will get approval to actually implement it, but I am curious if it is that simple?

2 Likes

Not totally sure when it would land in the product. Yeah, it should be fairly simple to implement something that accomplishes this. If you'd like to see it land in Kibana, however, please make sure you post your intended solution in that issue linked to above. Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.