Finding exact value with hyphen on not analyzed field is not working


(asmierzchalski) #1

Hello together,

i'm using Logstash in combination with ElasticSearch. I have a field from type String which is not_analyzed. The values are containing hyphens. When i'm trying to filter with a term for this field and that value i'm not getting any results.

After reading http://www.elastic.co/guide/en/elasticsearch/guide/master/_finding_exact_values.html i guess this should be possible. I tried the example from this answer http://stackoverflow.com/questions/11566838/elastic-search-hyphen-issue-with-term-filter and it's working, so i'm not sure where the problem with the index from Logstash or my Filter is.

Field description in the index:
"objectId":{"type":"string","norms":{"enabled":false},"fields":{"raw{"type":"string","index":"not_analyzed","ignore_above":256}}}

My filter query:
curl -XGET http://localhost:9200/_all/_search -d '{
"filter" : {
"term" : {
"objectId" : "8c9a3c20-744e-44d7-8467-621a9b461002"
}
}
}'


(asmierzchalski) #2

I've found the solution myself. Logstash provides the fields analyzed and not_analyzed in the .raw field.
So i only have to query the objectId.raw field.


(system) closed #3