I have an index for a Store with a type for Items, i.e. /store/items
.
among other properties, Items have a Title
(analyzed text), a
Description
(analyzed text), and Tags
(not_analyzed text).
I want to be able to show the facets over Tags with counts, so if a facet of the Tag "Yellow" has a count of 12, for example, then when the user adds that Tag to the filter she will see only 12 items.
I am using a Filtered Query with Aggs, as shown below, on Elasticsearch 1.1.1 on a single node:
GET _search {
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "Large Widgets",
"fields": [
"title^3",
"description"
]
}
},
"filter": {
"terms": {
"tags": [
"Colorful"
],
"execution": "and"
}
}
}
},
"aggs": {
"available_tags": {
"terms": {
"field": "tags"
}
},
"size": 20
}
}
I have two problems:
No matter what value I pass for the aggs/size I get 10 aggregations.
I want to get more than 10.The hits count that comes back when adding the new tag to the filter doesn't match the doc_count that came with the aggregations, for example, the aggregations might show a doc_count of 12 for the tag "Yellow", but if I add "Yellow" to the filter terms so that it reads
"tags": [ "Colorful", "Yellow" ]
I get 17 hits instead of the expected 12.
This usually does not happen at the first level, but only in subsequent drill down.
am I doing something wrong? is there a bug somewhere?
this is a cross post from the Elasticsearch mailing list which didn't get enough attention