hey Nik, thanks for your reply.
you are correct about the default operator being "or", but as I've posted in the original post I explicitly set it to "and" via "execution": "and" and I see the difference in the results between "or" and "and" so I know that it is working. for some reason the numbers still do not match some of the time though. Igal On Sunday, April 20, 2014 12:32:31 PM UTC-7, Nikolas Everett wrote: > > > > Sent from my iPhone > > > On Apr 20, 2014, at 3:06 PM, "Igal @ getRailo.org" > > <[email protected]<javascript:>> > wrote: > > > > 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.0 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: > > > > 1) no matter what value I pass for the aggs/size I get 10 aggregations. > I want to get more than 10. > > > > 2) 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. > > If I recall the terms filter is an or filter. So you are getting colorful > or yellow. It might have an and option. Not sure, on my phone now. > Otherwise use a bool filter with two must subfilters to do an and. > > Nik > > > > am I doing something wrong? is there a bug somewhere? > > > > TIA, > > > > > > Igal > > > > > > > > > > -- > > 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 [email protected] <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/53541AB6.4000403%40getrailo.org. > > > > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f6ce5c0d-37ec-45b6-972b-03dbd426e7de%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
