Elastic search : Facet Query

HI Floks,

Below is my Elastic search query with facets and its result.

I have a field in elastic search "TopicWords":"http://t.co/uky". And i am
running the facet query in it.

My ESquery:-
curl -XGET 'http://localhost:9200/new_index/new_indext/_search?size=0'
-d'{"query":{"filtered":{"query":{"bool":{"should":[{"field":{"TopicWords":"
http://t.co/uky"}},"minimum_number_should_match":1}}, "filter":
{"range":{"CreatedAt":
{"from":"2013-02-01T00:00:00"}}}}},"facets":{"TopicWords":{"terms":{"field":"TopicWords","size":200}}}}'

results:
{"took":134,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.23350935,"hits":[{"_index":"new_index","_type":"new_indext","_id":"314658172369518592","_score":0.23350935,"fields":{"_id":"314658172369518592"}}]},"facets":{"TopicWords":{"_type":"terms","missing":0,"total":11,"other":1,"terms":[{"term":"uky","count":1},{"term":"
t.co","count":1},{"term":"http","count":1}]}}}

I am pretty confuse why facet result is coming like this. It splits on : ,
// and / i.e. "terms":[{"term":"uky","count":1},{"term":"t.co
","count":1},{"term":"http","count":1}]

How i get the exact value of the Topicwords Field in return of facet query
without splitting.

Regrads
Mohit Kumar Yadav
(MCA/BBA)
Email Id : mohit.kumar.ngi@gmail.com

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

You have to change your mapping and set your field to not analyzed or use a keyword analyzer.
If you need also to search on this field, you can use multifield type and define a mapping for search (default) and one other for facets (TopicWords.facet for example)

HTH

David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 26 mars 2013 à 07:17, Mohit Kumar Yadav mohit.kumar.ngi@gmail.com a écrit :

HI Floks,

Below is my Elastic search query with facets and its result.

I have a field in elastic search "TopicWords":"http://t.co/uky". And i am running the facet query in it.

My ESquery:-
curl -XGET 'http://localhost:9200/new_index/new_indext/_search?size=0' -d'{"query":{"filtered":{"query":{"bool":{"should":[{"field":{"TopicWords":"http://t.co/uky"}},"minimum_number_should_match":1}}, "filter": {"range":{"CreatedAt": {"from":"2013-02-01T00:00:00"}}}}},"facets":{"TopicWords":{"terms":{"field":"TopicWords","size":200}}}}'

results:
{"took":134,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.23350935,"hits":[{"_index":"new_index","_type":"new_indext","_id":"314658172369518592","_score":0.23350935,"fields":{"_id":"314658172369518592"}}]},"facets":{"TopicWords":{"_type":"terms","missing":0,"total":11,"other":1,"terms":[{"term":"uky","count":1},{"term":"t.co","count":1},{"term":"http","count":1}]}}}

I am pretty confuse why facet result is coming like this. It splits on : , // and / i.e. "terms":[{"term":"uky","count":1},{"term":"t.co","count":1},{"term":"http","count":1}]

How i get the exact value of the Topicwords Field in return of facet query without splitting.

Regrads
Mohit Kumar Yadav
(MCA/BBA)
Email Id : mohit.kumar.ngi@gmail.com

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.