Change the data type mapping of a field


(gearoid houston) #1

Hi,

I have a loaded index in Kibana. I need to perform a regex search on one of the fields. The field is currently type 'text' and the regex search doesn't seem to work correctly on 'text' fields. I have tested my regex searches on 'keyword' fields and they work perfectly. Therefore I am looking to change the field from 'text' to 'keyword' so I can perform regex searches on this field.

Is this possible and if so, how can it be achieved?

Thanks


(Leandro Sampaio) #2

Use this tip:
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html

POST /twitter/_close

PUT /twitter/_settings
{
"analysis" : {
"analyzer":{
"content":{
"type":"custom",
"tokenizer":"whitespace"
}
}
}
}

POST /twitter/_open

Adapt to your case.


(Mark Walkom) #3

That won't work unfortunately. You will need to reindex with a mapping that matches what you want.


(gearoid houston) #4

ok, so the only resolution is to create a new index with new mappings and input all the data again ?


(gearoid houston) #5

I did more research today and found the re index API which seems to achieve the task I want.


(system) #6

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