Reputation: 43
I have 6 simple documents:
{"id":1,"sid":"adf6eb4f-35a0-4099-95d4-00ce3d984cf2","asid":"577ce6b0-b8b7-49af-8528-4e4797027a12","_tid":"21"}
{"id":1,"sid":"adf6eb4f-35a0-4099-95d4-00ce3d984cf2","asid":"577ce6b0-b8b7-49af-8528-4e4797027a12","_tid":"21"}
{"id":2,"sid":"abcdef","asid":"fedcba","_tid":"21"}
{"id":3,"sid":"ghijk","asid":"kjihg","_tid":"21"}
{"id":4,"sid":"lmnop","asid":"ponml","_tid":"21"}
{"id":5,"sid":"prstuv","asid":"vutsrp","_tid":"21"}
I am running a value_count aggregation on this dataset using:
curl -XGET 'http://poc02.transerainc.com:9200/test/csrs/_search' -d '{"size":0,"aggregations":{"SUMMARY_0_sid":{"value_count":{"field":"sid"}}}}'
I am expecting the results to be 6 but I am getting 14!
{"took":3,"timed_out":false,"shards":{"total":5,"successful":5,"failed":0},"hits":{"total":6,"maxscore":0.0,"hits":[]},"aggregations":{"SUMMARY_0_sid":{"value":14}}}
this seems to be an obvious error but what am I missing here?
Upvotes: 0
Views: 166
Reputation: 1224
you should check your elasticsearch mapping setting for sid
, is sid
an analyzed
field (it most likely is by default)? if it is being treated as an analyzed
field then "adf6eb4f-35a0-4099-95d4-00ce3d984cf2" would be broken up into 5 different pieces. so total count accumulates to 5+5+1+1+1+1=14
Upvotes: 2