Let's say I have an Elasticsearch index called "item-tag" where each document contains only one itemid (long) and only one tag (keyword). There are multiple documents with same item id and multiple documents with same tag but the documents are unique so the same combination of itemid and tag doesn't appear twice.
So how can I get the number of unique itemids for some two different tags?
Is the only way to create a new index where there is only one document per itemid and each document has an array of tags or is it possible with the current index?
Data in index:
itemid:1 tag:A itemid:1 tag:B itemid:1 tag:C itemid:2 tag:B itemid:2 tag:C itemid:2 tag:D itemid:3 tag:B itemid:3 tag:D
A B C D A 1 1 1 0 B 1 3 2 2 C 1 2 2 1 D 0 2 1 2
Regards, Markus Paaso