See
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-not-filter.html

You should probably switch to a bool and a should clause before instead of
an and filter

--

Itamar Syn-Hershko
http://code972.com | @synhershko <https://twitter.com/synhershko>
Freelance Developer & Consultant
Author of RavenDB in Action <http://manning.com/synhershko/>

On Tue, Oct 14, 2014 at 9:26 PM, Waldemar Neto <[email protected]> wrote:

> Hello all!
> ia have a criteria with *AND* , *OR* and *NOT* operator, but the *NOT* is
> a single Filter, what is the best way to set multiples *NOT's*?
>
> see my query with *AND*
>
> my *AND* i need *NOT* :D
>
> {
>     "highlight": {
>         "fields": {
>             "*": {
>                 "fragment_size": 150,
>                 "number_of_fragments": 1,
>                 "pre_tags": [
>                     "<b>"
>                 ],
>                 "post_tags": [
>                     "</b>"
>                 ]
>             }
>         }
>     },
>     "facets": {
>         "documents": {
>             "terms": {
>                 "field": "primary_field",
>                 "size": 5
>             }
>         }
>     },
>     "fields": [
>         "Document.id",
>         "Document.name",
>         "Document.updated",
>         "DocumentTag.name",
>         "Document.approval_number",
>         "Document.approval_number_us",
>         "Document.approval_number_jp",
>         "Version.status",
>         "Document.rate",
>         "Document.last_status"
>     ],
>     "sort": [
>         "_type"
>     ],
>     "size": 100000,
>     "query": {
>         "filtered": {
>             "query": {
>                 "match_all": {}
>             },
>             "filter": {
>                 "and": {
>                     "filters": [
>                         {
>                             "terms": {
>                                 "Product.id": [
>                                     "6"
>                                 ]
>                             }
>                         },
>                         {
>                             "terms": {
>                                 "Version.jp": [
>                                     true
>                                 ]
>                             }
>                         },
>                         {
>                             "terms": {
>                                 "Version.jp": [
>                                     true
>                                 ]
>                             }
>                         },
>                         {
>                             "terms": {
>                                 "Document.last_status": [
>                                     "4"
>                                 ]
>                             }
>                         }
>                     ]
>                 }
>             }
>         }
>     }
> }
>
> --
> 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/d9d34e14-7d3c-41a5-b3ad-a33ccbd79d45%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/d9d34e14-7d3c-41a5-b3ad-a33ccbd79d45%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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/CAHTr4ZvhhpLcLojKEk0%2Bw_sx%3DFeMkOnvSbiK-aWYeH7ByD1WWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to