How to fetch the distinct records from Elastic Search

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to fetch the distinct records from Elastic Search

sowjanya
How to fetch the distinct records from Elastic Search. 
Eg: 
field1 field2 field3
1       abc    xyz 
2       abc    def 
3       abc    pqr 
Now,iam searhing for xyz OR def OR pqr.
For these records field2 value is same. 
now,Iam getting the 3 records(abc,abc,abc). But,I need only one record(abc). Without iterating the searchHits.
 In SearchHits it should consists only distinct records.

How,can i query for getting the distinct Results.

 Please help me. 
Thanks in Advance.

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch the distinct records from Elastic Search

ppearcy
Take a look at facets. As long as, your data is indexed appropriately, it will give you roll up counts of values for each field specified for a query. 

Best Regards,
Paul

On Monday, November 25, 2013 2:31:55 PM UTC-5, Elastic Sowjanya wrote:
How to fetch the distinct records from Elastic Search. 
Eg: 
field1 field2 field3
1       abc    xyz 
2       abc    def 
3       abc    pqr 
Now,iam searhing for xyz OR def OR pqr.
For these records field2 value is same. 
now,Iam getting the 3 records(abc,abc,abc). But,I need only one record(abc). Without iterating the searchHits.
 In SearchHits it should consists only distinct records.

How,can i query for getting the distinct Results.

 Please help me. 
Thanks in Advance.

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.