Cannot get the correct field's type on kibana

Hi everyone,

I have a problem on Kibana, I converted a field from string to integer on the logstash configuration file using mutate { convert ..
....
if [exportedRecords]{
mutate{
convert => { "exportedRecords" => "integer" }
}
....

But when i get the field on kibana, i get it as a string.

What should i do ?

Best Regards.

Hi,
The type of field is configured in Elasticsearch.

If you didn't specify mapping for your index a default dynamic mapping probably set the field type to text. Once something is written into the index the mapping won't change.

You should create a template for the logstash index and specify a mapping. Then recreate the index.

Just recreating the index can also help. If the first item you write to index to the field is a number, the mapping may be automatically set to number, but this is not the correct way.

If i recreate the index, is there any risk to lose the data i already have on it ? and how could i create a template for the logstash index please?

Thank you.

A field type for old data can be changed but it will require reindexing (Reindex API). There is also a nice blog about changing mapping https://www.elastic.co/blog/changing-mapping-with-zero-downtime.

If you never heard about mapping and templates, it would be good to google a bit and eventually come with more specific questions and your use case.

thank you

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