Minor regression in Java API 0.19.9?


(Jan Fiedler) #1

I just upgraded to 0.19.9 and my test suite (using Java client) found a
minor regression that I wanted to double-check with the experts.
Calling QueryBuilders.boolQuery().minimumNumberShouldMatch( 1 ) generates
different json 0.19.8 and 0.19.9:

0.19.8

"bool" : {
"minimum_number_should_match" : 1
}

0.19.9

"bool" : {
"minimum_should_match" : "1"
}

This is minor - however I just want to make sure we are not breaking
compatiblity at the Json level.

--


(Martijn Van Groningen) #2

Hi Jan,

At the json level both "minimum_should_match" and
"minimum_number_should_match" can be used (You can see that in
BoolQueryParser).

Martijn

On 28 August 2012 17:57, Jan Fiedler fiedler.jan@gmail.com wrote:

I just upgraded to 0.19.9 and my test suite (using Java client) found a
minor regression that I wanted to double-check with the experts. Calling
QueryBuilders.boolQuery().minimumNumberShouldMatch( 1 ) generates different
json 0.19.8 and 0.19.9:

0.19.8

"bool" : {
"minimum_number_should_match" : 1
}

0.19.9

"bool" : {
"minimum_should_match" : "1"
}

This is minor - however I just want to make sure we are not breaking
compatiblity at the Json level.

--

--
Met vriendelijke groet,

Martijn van Groningen

--


(phill) #3

Just to be perfectly clear. As Martin said, these are synonyms of each
other when applied to boolQuery.

"minimum_should_match" is not documented (but now it is for those searching the e-mail list!)

minimum_should_match is actually described on the site as parameter to query_string.
http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html
And is a percent as used there.

While minimum_number_should_match is the name of a property of BoolQuery and BoolQueryBuilder and doc'ed at:
http://www.elasticsearch.org/guide/reference/query-dsl/bool-query.html

Thus the generated json is using the "wrong" term (it neither matches the code nor docs, but is usable).

Someone else can decide if the right thing to do is to change it back to what it was and how that effects query_string.

-Paul

On 8/29/2012 2:23 AM, Martijn v Groningen wrote:

Hi Jan,

At the json level both "minimum_should_match" and
"c" can be used (You can see that in
BoolQueryParser).

Martijn

On 28 August 2012 17:57, Jan Fiedler fiedler.jan@gmail.com wrote:

I just upgraded to 0.19.9 and my test suite (using Java client) found a
minor regression that I wanted to double-check with the experts. Calling
QueryBuilders.boolQuery().minimumNumberShouldMatch( 1 ) generates different
json 0.19.8 and 0.19.9:

0.19.8

"bool" : {
"minimum_number_should_match" : 1
}

0.19.9

"bool" : {
"minimum_should_match" : "1"
}

This is minor - however I just want to make sure we are not breaking
compatiblity at the Json level.

--

--


(Shay Banon) #4

The current behavior is fully backward compatible with previous versions. The json generated generates minimum_should_match, but minimum_number_should_match also works.

The idea was the streamline all places where the parameter is applicable to use the same name (minimum_should_match), and also streamline the support for more complex expression there except for "5" (or a number). For example, using percentage like "20%". This should be properly documented (the syntax) and referred to in the different queries it applies to.

On Aug 29, 2012, at 9:30 PM, P. Hill parehill1@gmail.com wrote:

Just to be perfectly clear. As Martin said, these are synonyms of each other when applied to boolQuery.

"minimum_should_match" is not documented (but now it is for those searching the e-mail list!)

minimum_should_match is actually described on the site as parameter to query_string.
http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html
And is a percent as used there.

While minimum_number_should_match is the name of a property of BoolQuery and BoolQueryBuilder and doc'ed at:
http://www.elasticsearch.org/guide/reference/query-dsl/bool-query.html

Thus the generated json is using the "wrong" term (it neither matches the code nor docs, but is usable).

Someone else can decide if the right thing to do is to change it back to what it was and how that effects query_string.

-Paul

On 8/29/2012 2:23 AM, Martijn v Groningen wrote:

Hi Jan,

At the json level both "minimum_should_match" and
"c" can be used (You can see that in
BoolQueryParser).

Martijn

On 28 August 2012 17:57, Jan Fiedler fiedler.jan@gmail.com wrote:

I just upgraded to 0.19.9 and my test suite (using Java client) found a
minor regression that I wanted to double-check with the experts. Calling
QueryBuilders.boolQuery().minimumNumberShouldMatch( 1 ) generates different
json 0.19.8 and 0.19.9:

0.19.8

"bool" : {
"minimum_number_should_match" : 1
}

0.19.9

"bool" : {
"minimum_should_match" : "1"
}

This is minor - however I just want to make sure we are not breaking
compatiblity at the Json level.

--

--

--


(phill) #5

On 8/29/2012 2:18 PM, Shay Banon wrote:

This should be properly documented (the syntax) and referred to in the different queries it applies to.

Glad to clarify what needs to be changed. In this case only the documentation.

-Paul

--


(system) #6