How to get distinct results in ElasticSearch if a field is the same -


i have elasticsearch service version 1.4 index 40m record of data.

i have data has same parent field. extract 1 unique result out of same parent only.

ex:

{     "id": "7835",     "isbn": "3985",     "parent_id": "7819", }, {     "id": "1835",     "isbn": "4935",     "parent_id": "7719", }, {     "id": "2835",     "isbn": "9985",     "parent_id": "7819", } 

the expected result have is:

{     "id": "7835",     "isbn": "3985",     "parent_id": "7819", }, {     "id": "1835",     "isbn": "4935",     "parent_id": "7719", }, 

i have checked out aggregations: elasticsearch - return unique values

{     "aggs" : {     "parentid" : {         "terms" : { "field" : "parent_id" } } 

however response - show 3 items (so last 1 doesn't ignored), , have term buckets key afterwards inside aggregations response, me not useful seems tell me how many occurrence per key inside doc, not desired output.

in order not search original document, should add "size":0 above aggregation.

you can see number of documents per each parent_id in buckets field of response.

{     "size" : 0,     "aggs" : {     "parentid" : {         "terms" : { "field" : "parent_id" }     } } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -