elasticsearch - Trouble with spaces in query to elasticsearh -
i'm experiencing trouble requesting fileds making requests on field spaces. mapping looks this:
"myindexname": { "mappings": { "mytype": { "properties": { "mypropertywithspaces": { "type": "string", "analyzer": "analyzer_keyword" } } } } }
there "analyzer_keyword" cutom analyzer keyword tokenizer , lowercase filter. when i'm sending "_analyze" request "analyzer_keyword" analyzer , query "firstword secondword" token "firstword secondword" - works expected. querystring request returns nothing if don't change space character "?" wildcard; interesting, lowercasing still works , such behaviour doesn't change if i'm telling elasticsearch use "analyzer_keyword" explicitly.
"query": { "query_string": { "query": "firstword secondword", "default_field": "mypropertywithspaces", "analyzer": "analyzer_keyword" }
found solution in simple escaping space character "\ ". works correctly , prevents querystring processor injecting "and or" operators or whatever.
Comments
Post a Comment