Oh right. That should have been obvious. It seems to be working great that way. Thanks!
Nathan On Jan 9, 2014, at 1:10 PM, Sloan Ahrens <[email protected]> wrote: > You were close. You just had the "nested" and "not" filters in the wrong > order, basically. > > Your (first) query says "return items that have a rating with > 'ratings.rater_username' not equal to 'user1'". And so you get the first > item, since it meets that requirement. > > What you really want to say is "return items for which all ratings have > 'ratings.rater_username' not equal to 'user1'". Here is the query you want: > > curl -XPOST "http://localhost:9200/nestedfilters/item/_search" -d' > { > "query": { > "match_all": {} > }, > "filter": { > "not": { > "nested": { > "path": "ratings", > "filter": { > "term": { > "ratings.rater_username": "user1" > } > } > } > } > } > }' > > Here is a runnable example you can play with (you will need ES installed and > running at localhost:9200, or supply another endpoint): > http://sense.qbox.io/gist/289ceb80480db8b6574d5f879358e50c97aaf5da > > > > > ----- > Co-Founder and CTO, StackSearch, Inc. > Hosted Elasticsearch at http://qbox.io > -- > View this message in context: > http://elasticsearch-users.115913.n3.nabble.com/Using-NOT-in-a-nested-filter-tp4047349p4047353.html > Sent from the ElasticSearch Users mailing list archive at Nabble.com. > > -- > You received this message because you are subscribed to a topic in the Google > Groups "elasticsearch" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/elasticsearch/7yWbMCYmAFw/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/1389298238074-4047353.post%40n3.nabble.com. > For more options, visit https://groups.google.com/groups/opt_out. -- 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/128FBB57-B971-4D1C-A3A6-E4F5A3F2BC3D%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
