Is giving.assignee a sub-object or a nested document? Can you provide your
mapping? Use the mapping API for exact results (
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-mapping.html
)

Perhaps enabling explain would provide some hints,

-- 
Ivan


On Wed, Sep 3, 2014 at 2:07 PM, ElasticRabbit <ayushsang...@gmail.com>
wrote:

> Hi Everyone,
>
> Goal: I want to find all the documents which does not have giving.assignee
> field.
>
> I am executing below query on ES version 1.3.2 involving exists filter and
> boolean filter.
>
> {
>     "query": {
>         "filtered": {
>            "query": {
>               "match_all": {}
>            },
>            "filter": {
>                "bool": {
>                    "must_not": [
>                       {
>                           "exists": {
>                              "field": "giving.assignee"
>                           }
>                       }
>                    ]
>                }
>            }
>         }
>     },
>     "size": 2000
> }
>
> While executing this query it gives me those documents also where
> giving.assignee field exists or has some value in it.
> We have around 2 million documents and it's returning almost close to 2
> million documents.
>
> I have also tried using the missing filter but no luck.
>
> {
>     "query": {
>         "filtered": {
>             "query": {
>                 "match_all": {}
>             },
>             "filter": {
>                 "bool": {
>                     "must": [
>                         {
>                             "missing": {
>                                 "field": "giving.assignee"
>                             }
>                         }
>                     ]
>                 }
>             }
>         }
>     },
>     "size": 20000
> }
>
> Same result as of the above query.
> If someone can point me what am I doing wrong here or if further
> information is needed please let me know.
> Looking forward for help.
>
> Thanks,
> Ayush Sangani
>
>
>  --
> 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 elasticsearch+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/89f2193a-5f11-447f-901c-29790318ddbf%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/89f2193a-5f11-447f-901c-29790318ddbf%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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBxKY4_GOfEP2PXhd0on16KZvT6Z%3D%2Bx2zwci%3D9KHJy6sQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to