Missing filter with nested objects


(Ernesto Reig) #1

Hello,
I know that this has been discussed in other threads but I would like to
know if I am missing something or it is just that missing filter does not
work properly with nested objects.
I have left the examples I have been running:


You can have a look and tell me if I am doing something wrong or it works
just like that. As a workaround I would add a field to indicate whether the
nested object attribute ("priosenio" in this case) is empty or not.

Thank you very much,

Ernesto

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Boaz Leskes) #2

Hi Ernesto,

What you need is:

curl -XPOST "http://ocvli-apw602:9200/test2/IR/_search" -d'
{
"filter": {
"not": {
"nested": {
"path": "priosenio",
"filter": {
"match_all": {}
}
}
}
}
}'

I do feel that your gut feeling is correct in expecting the missing filter
to just work. Please feel free to open an issue on github explaining it.

Cheers,
Boaz

On Friday, November 15, 2013 2:18:10 PM UTC+1, Ernesto Reig wrote:

Hello,
I know that this has been discussed in other threads but I would like to
know if I am missing something or it is just that missing filter does not
work properly with nested objects.
I have left the examples I have been running:
https://gist.github.com/Erni/7484095
You can have a look and tell me if I am doing something wrong or it works
just like that. As a workaround I would add a field to indicate whether the
nested object attribute ("priosenio" in this case) is empty or not.

Thank you very much,

Ernesto

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Ernesto Reig) #3

Hi Boaz,
I don´t quite understand exactly how that query works, but I ´ll look into
it.
In any case, what my "gut feeling" is saying is "use the missing filter to
find the docs with empty or no priosenio attribute, as it does with normal
objects".

Thank you very much for your response, it´s been very helpful :slight_smile:

Ernesto

On 15 November 2013 21:54, Boaz Leskes b.leskes@gmail.com wrote:

Hi Ernesto,

What you need is:

curl -XPOST "http://ocvli-apw602:9200/test2/IR/_search" -d'
{
"filter": {
"not": {
"nested": {
"path": "priosenio",
"filter": {
"match_all": {}
}
}
}
}
}'

I do feel that your gut feeling is correct in expecting the missing filter
to just work. Please feel free to open an issue on github explaining it.

Cheers,
Boaz

On Friday, November 15, 2013 2:18:10 PM UTC+1, Ernesto Reig wrote:

Hello,
I know that this has been discussed in other threads but I would like to
know if I am missing something or it is just that missing filter does not
work properly with nested objects.
I have left the examples I have been running: https://gist.github.
com/Erni/7484095
You can have a look and tell me if I am doing something wrong or it works
just like that. As a workaround I would add a field to indicate whether the
nested object attribute ("priosenio" in this case) is empty or not.

Thank you very much,

Ernesto

--
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/Lgn7ve6RbV8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4