Original commit message

ChangeScribe message

Support multiple rescores

			Detects
			if rescores arrive as an array instead of a plain object.  If so
			then
			parse each element of the array as a separate rescore to be
			executed
			one
			after another.  It looks like this:
			   "rescore"
			: [ {
			      "window_size"
			: 100,
			      "query"
			: {
			         "rescore_query"
			: {
			            "match"
			: {
			               "field1"
			: {
			                  "query"
			: "the quick brown",
			                  "type"
			: "phrase",
			                  "slop"
			: 2
			               }
			            }
			         },
			         "query_weight"
			: 0.7,
			         "rescore_query_weight"
			: 1.2
			      }
			   },
			{
			      "window_size"
			: 10,
			      "query"
			: {
			         "score_mode":
			"multiply",
			         "rescore_query"
			: {
			            "function_score"
			: {
			               "script_score":
			{&'?1>01G1G<<>6=?<!F?;<>!>49GE;66?>6=9F1G:9
			                  "script":
			"log10(doc['numeric'].value + 2)"
			               }
			            }
			         }
			      }
			   }
			]
			

			Rescores
			as a single object are still supported.
			

			Closes
			#4748

BUG - FEATURE: <type-ID>


This is a degenerate modifier commit: this change set is composed of empty, incidental, and abstract methods. These methods indicate that a new feature is planned. This change set is mainly composed of:


1. Changes to package org.elasticsearch.search.builder:


1.1. Modifications to SearchSourceBuilder.java:


1.1.1. Add method invocation to method endObject of builder object at toXContent(XContentBuilder,Params) method

1.1.2. Add line comment at toXContent(XContentBuilder,Params) method

1.1.3. Add variable declaration statement at toXContent(XContentBuilder,Params) method

1.1.4. Add while statement at toXContent(XContentBuilder,Params) method

1.1.5. Add if statement at toXContent(XContentBuilder,Params) method

1.1.6. Add method invocation to method endArray of builder object at toXContent(XContentBuilder,Params) method

1.1.7. Add else part of (rescoreBuilders.size() == 1) condition

1.1.8. Add method invocation to method startObject of builder object at toXContent(XContentBuilder,Params) method

1.1.9. Add method invocation to method toXContent of rescoreBuilders.get(0) object at toXContent(XContentBuilder,Params) method

1.1.10. Add method invocation to method remove of itr object at toXContent(XContentBuilder,Params) method

1.1.11. Add method invocation to method field of builder object at toXContent(XContentBuilder,Params) method

1.1.12. Add method invocation to method startArray of builder object at toXContent(XContentBuilder,Params) method

1.1.13. Add foreach statement at toXContent(XContentBuilder,Params) method

1.1.14. Modify conditional expression rescoreBuilder != null with (rescoreBuilders != null) at toXContent(XContentBuilder,Params) method

1.1.15. Add a functionality to get default rescore window size (SearchSourceBuilder)

1.1.16. Add a functionality to add rescorer

1.1.17. Add a functionality to get clear rescorers (SearchSourceBuilder)

1.1.18. Remove an unused functionality to rescore search source builder

1.1.19. Rename rescoreBuilder object attribute with rescoreBuilders

1.1.20. Change attribute type RescoreBuilder with List<RescoreBuilder>

1.1.21. Add (Object state) defaultRescoreWindowSize attribute


The added/removed methods triggered changes to SearchRequestBuilder class


2. Changes to package org.elasticsearch.search.internal:


2.1. Modifications to SearchContext.java:


2.1.1. Modify javadoc at rescore() method

2.1.2. Rename rescore method with addRescore


3. Changes to package org.elasticsearch.search.rescore:


3.1. Modifications to RescoreBuilder.java:


3.1.1. Remove method invocation to start object at toXContent(XContentBuilder,Params) method

3.1.2. Remove method invocation to end object at toXContent(XContentBuilder,Params) method

3.1.3. Remove if statement at toXContent(XContentBuilder,Params) method

3.1.4. Add a functionality to get window size (Integer)

3.1.5. Add a functionality to is empty


The added/removed methods triggered changes to SearchSourceBuilder class, DfsPhase class


3.2. Modifications to Rescorer.java:


3.2.1. Add parameter source explanation at explain(int,SearchContext,RescoreSearchContext,Explanation) method

3.2.2. Modify javadoc at explain(int,SearchContext,RescoreSearchContext,Explanation) method