I need a query to get one document from 3 documents


(ravikumar kotta) #1

Hi,

{"query":{"bool":{"must":[{"term":{"cmd":"addmember"}},{"term":{"user":"admin1"}},{"range":{"time":{"gte":1399985905,"lte":1400590215}}}],"must_not":[],"should":[]}},"from":0,"size":50,"sort":[],"facets"
: {"chatId" : {"terms" : {"field" : "chatId", "size" : 10}}}}}

I am writing query to get documents of distinct chatId. But that is not
working. its giving all 3 documents. Can any body help me about same.

[{"lastName":"Admin1","index":"graph","resource":"admin1","from":"admin1","es_metadata_id":"8L4y5bFPScObTmUs9bTD5g","type":"normal","cmd":"addMember","time":1.400590215E9,"ticket":"19145","role":"operator","queueName":"","firstName":"Training","user":"admin1",
"chatId":"cv6D2QOh"
},{"lastName":"Admin1","index":"graph","resource":"admin1","from":"admin1","es_metadata_id":"ukExn7gNQ6ykMVXuPoDZRA","type":"normal","cmd":"addMember","time":1.400590215E9,"ticket":"19145","role":"operator","queueName":"","firstName":"Training","user":"admin1",
"chatId":"cv6D2QOh"
},{"lastName":"Admin1","index":"graph","resource":"admin1","from":"admin1","es_metadata_id":"PtC3r7EYR1GstrsfWqQxzg","type":"normal","cmd":"addMember","time":1.400590215E9,"ticket":"19145","role":"operator","queueName":"","firstName":"Training","user":"admin1",
"chatId":"cv6D2QOh"}]

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/56dea746-6c64-4d52-873f-ea4fd12f0f25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Telax) #2

I think in this case a terms facet would help you.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/497d9a93-c680-49da-87e4-63c4bc3a710f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3