Hi Team,
I am getting below error while executing elasticsearch SQL query for translating it to elastic query on multifield:
{ * "error": { * "root_cause": [ * { * "type": "verification_exception", * "reason": "Found 1 problem(s) line 1:36: [productDescription.KeywordField like '%moringa%'] cannot operate on field of data type [text]: No keyword/multi-field defined exact matches for [KeywordField]; define one or use MATCH/QUERY instead"}], * "type": "verification_exception", * "reason": "Found 1 problem(s) line 1:36: [productDescription.KeywordField like '%moringa%'] cannot operate on field of data type [text]: No keyword/multi-field defined exact matches for [KeywordField]; define one or use MATCH/QUERY instead"}, * "status": 400 }
I am using Elasticsearch 7.3.0.
Below is the query which I am using for sql translate api -
http://localhost:9200/_sql/translate { "query": "SELECT * FROM \"t3-imp-2019\" where (productDescription.KeywordField like '%moringa%')" }
Below is my index mapping and settings:
{ "settings": { "index": { "analysis": { "normalizer": { "lowercase_normalizer": { "filter": [ "lowercase" ], "type": "custom", "char_filter": [] } }, "analyzer": { "keyword-analyser": { "filter": [ "lowercase" ], "type": "custom", "tokenizer": "keyword" } } } } }, "mappings": { "_doc": { "properties": { "productDescription": { "analyzer": "english", "type": "text", "fields": { "KeywordField": { "analyzer": "keyword-analyser", "type": "text" } } } } } } }
According to error if I am trying to convert productDescription field type to "keyword", then it is giving below error:
{ * "error": { * "root_cause": [ * { * "type": "mapper_parsing_exception", * "reason": "no handler for type [Keyword] declared on field [KeywordField]"}], * "type": "mapper_parsing_exception", * "reason": "Failed to parse mapping [_doc]: no handler for type [Keyword] declared on field [KeywordField]", * "caused_by": { * "type": "mapper_parsing_exception", * "reason": "no handler for type [Keyword] declared on field [KeywordField]"}}, * "status": 400 }