Empty terms for Terms Filter in 0.21

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Empty terms for Terms Filter in 0.21

Paweł Młynarczyk
Hello,

I've been trying out the new beta version of ES and I've got a question.

Version 0.19.x allowed us to provide an empty set of Terms for Terms Filter:

{
   
"constant_score" : {
       
"filter" : {
           
"terms" : { "user" : []}
       
}
   
}
}

and now, in 0.21 it is forbidden, ES throws IllegalArgumentException[no terms provided].

Is that intended?

Regards,
Paweł Młynarczyk

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Empty terms for Terms Filter in 0.21

Igor Motov-3
Yes, it's result of this change: https://issues.apache.org/jira/browse/LUCENE-4511

On Friday, February 1, 2013 11:04:34 AM UTC-5, Paweł Młynarczyk wrote:
Hello,

I've been trying out the new beta version of ES and I've got a question.

Version 0.19.x allowed us to provide an empty set of Terms for Terms Filter:

{
   
"constant_score" : {
       
"filter" : {
           
"terms" : { "user" : []}
       
}
   
}
}

and now, in 0.21 it is forbidden, ES throws IllegalArgumentException[no terms provided].

Is that intended?

Regards,
Paweł Młynarczyk

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Empty terms for Terms Filter in 0.21

kimchy
Administrator
In reply to this post by Paweł Młynarczyk
What do you expect when providing an empty array, do you mean to find documents that have no values for user? We have the missing filter for it, but we could identify an empty array and automatically do a "missing" filter in that case.

On Feb 1, 2013, at 5:04 PM, Paweł Młynarczyk <[hidden email]> wrote:

Hello,

I've been trying out the new beta version of ES and I've got a question.

Version 0.19.x allowed us to provide an empty set of Terms for Terms Filter:

{
   
"constant_score" : {
       
"filter" : {
           
"terms" : { "user" : []}
       
}
   
}
}

and now, in 0.21 it is forbidden, ES throws IllegalArgumentException[no terms provided].

Is that intended?

Regards,
Paweł Młynarczyk

--
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 [hidden email].
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Empty terms for Terms Filter in 0.21

dadoonet
I created a Pull Request here: https://github.com/elasticsearch/elasticsearch/pull/2613

David.

Le 2 févr. 2013 à 23:07, [hidden email] a écrit :

What do you expect when providing an empty array, do you mean to find documents that have no values for user? We have the missing filter for it, but we could identify an empty array and automatically do a "missing" filter in that case.

On Feb 1, 2013, at 5:04 PM, Paweł Młynarczyk <[hidden email]> wrote:

Hello,

I've been trying out the new beta version of ES and I've got a question.

Version 0.19.x allowed us to provide an empty set of Terms for Terms Filter:

{
   
"constant_score" : {
       
"filter" : {
           
"terms" : { "user" : []}
       
}
   
}
}

and now, in 0.21 it is forbidden, ES throws IllegalArgumentException[no terms provided].

Is that intended?

Regards,
Paweł Młynarczyk

--
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 [hidden email].
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 [hidden email].
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Empty terms for Terms Filter in 0.21

Wojciech Durczyński
I think that using missingFilter when termsFilter has empty terms list is misleading.
I understand termsFilter like: return only those documents, where a field has one of the values provided as terms.
So empty terms list in termsFilter == doesn't return anything == notFilter(matchAllFilter()).
Also notFilter(termsFilter with empty terms list) == matchAllFilter.

I use this behaviour of ES 0.19 to exclude some documents from results:
notFilter(termsFilter("documentType", <types to exclude from results>))
If <types to exclude from results> is empty then all documents should be returned.




--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Empty terms for Terms Filter in 0.21

Clinton Gormley-2
On Mon, 2013-02-04 at 02:40 -0800, Wojciech Durczyński wrote:
> I think that using missingFilter when termsFilter has empty terms list
> is misleading.

I agree.

> I understand termsFilter like: return only those documents, where a
> field has one of the values provided as terms.
> So empty terms list in termsFilter == doesn't return anything ==
> notFilter(matchAllFilter()).
> Also notFilter(termsFilter with empty terms list) == matchAllFilter.

I understand it differently. Giving that you are filtering documents, a
filter with no terms for me means: don't filter on anything, so give me
all docs, ie match_all

clint


--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.