Question about Missing filter on nested fields

Hello,

Imagine that we have a nested field adress : adress.street, adress.zipCode
I cannot use a missing filter on adress :
{
"query": {
"constant_score": {
"filter": {
"missing": {
"field": "adress"
}
}
}
}
}

nor on sub-fields :
{
"query": {
"constant_score": {
"filter": {
"missing": {
"field": "adress.zipCode"
}
}
}
}
}

Any idea ?

Thanks

You mean you are using nested mapping for adress? If so, you need to use
nested filter (
Elasticsearch Platform — Find real-time answers at scale | Elastic)
or query (
Elasticsearch Platform — Find real-time answers at scale | Elastic).

On Thu, Oct 6, 2011 at 10:10 AM, Alexandre Heimburger <
ahb@bluekiwi-software.com> wrote:

Hello,

Imagine that we have a nested field adress : adress.street, adress.zipCode
I cannot use a missing filter on adress :
{
"query": {
"constant_score": {
"filter": {
"missing": {
"field": "adress"
}
}
}
}
}

nor on sub-fields :
{
"query": {
"constant_score": {
"filter": {
"missing": {
"field": "adress.zipCode"
}
}
}
}
}

Any idea ?

Thanks

I'm sorry but I'm not sure to understand. Actually I did not use any
specific mapping. I just index the structure described in my post.

I've read and read and read again the documentation and I really don't get
how to make the missing filter working for that structure. Can you post any
example ?

Thanks a lot.

Can you post a sample document that you index?

On Fri, Oct 7, 2011 at 9:18 AM, Alexandre Heimburger <
ahb@bluekiwi-software.com> wrote:

I'm sorry but I'm not sure to understand. Actually I did not use any
specific mapping. I just index the structure described in my post.

I've read and read and read again the documentation and I really don't get
how to make the missing filter working for that structure. Can you post any
example ?

Thanks a lot.

{
"firstName" : "Alex",
"lastName": "Heim",
"adress" : {
"zipCode": 92200,
"street": "street of philadelphia"
}
}

Querying missing field on adress does not work (i.e : return all the
entries)

Querying missing field on adress.zipCode works well.

I think I got the pattern. You can query on missing field if the field is
not nested (i.e is a string, numerical).

Do you confirm ?

No, you can't do missing on a json object, just on concrete fields (that get
indexed).

On Mon, Oct 10, 2011 at 9:28 AM, Alexandre Heimburger <
ahb@bluekiwi-software.com> wrote:

{
"firstName" : "Alex",
"lastName": "Heim",
"adress" : {
"zipCode": 92200,
"street": "street of philadelphia"
}
}

Querying missing field on adress does not work (i.e : return all the
entries)

Querying missing field on adress.zipCode works well.

I think I got the pattern. You can query on missing field if the field is
not nested (i.e is a string, numerical).

Do you confirm ?