mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-26 08:07:27 -04:00
This adds support for setting the refresh request parameter to `wait_for` in the `index`, `delete`, `update`, and `bulk` APIs. When `refresh=wait_for` is set those APIs will not return until their results have been made visible to search by a refresh. Also it adds a `forced_refresh` field to the response of `index`, `delete`, `update`, and to each item in a bulk response. This will be true for requests with `?refresh` or `?refresh=true` and will be true for some requests (see below) with `refresh=wait_for` but ought to otherwise always be false. `refresh=wait_for` is implemented as a list of `Tuple<Translog.Location, Consumer<Boolean>>`s in the new `RefreshListeners` class that is managed by `IndexShard`. The dynamic, index scoped `index.max_refresh_listeners` setting controls a maximum number of listeners allowed in any shard. If more than that many listeners accumulate in the engine then a refresh will be forced, the thread that adds the listener will be blocked until the refresh completes, and then the listener will be called with a `forcedRefresh` flag so it knows that it was the "straw that broke the camel's back". These listeners are only used by `refresh=wait_for` and that flag manifests itself as `forced_refresh` being `true` in the response. About half of this change comes from piping async-ness down to the appropriate layer in a way that is compatible with the ongoing with with sequence ids. Closes #1063 You can look up the winding story of all the commits here: https://github.com/elastic/elasticsearch/pull/17986 Here are the commit messages in case they are intersting to you: commit59a753b891
Author: Nik Everett <nik9000@gmail.com> Date: Mon Jun 6 10:18:23 2016 -0400 Replace a method reference with implementing an interface Saves a single allocation and forces more commonality between the WriteResults. commit31f7861a85
Author: Nik Everett <nik9000@gmail.com> Date: Mon Jun 6 10:07:55 2016 -0400 Revert "Replace static method that takes consumer with delegate class that takes an interface" This reverts commit777e23a659
. commit777e23a659
Author: Nik Everett <nik9000@gmail.com> Date: Mon Jun 6 09:29:35 2016 -0400 Replace static method that takes consumer with delegate class that takes an interface Same number of allocations, much less code duplication. commit9b49a480ca
Author: Nik Everett <nik9000@gmail.com> Date: Mon Jun 6 08:25:38 2016 -0400 Patch from boaz commitc2bc36524f
Author: Nik Everett <nik9000@gmail.com> Date: Thu Jun 2 14:46:27 2016 -0400 Fix docs After updating to master we are actually testing them. commit03975ac056
Author: Nik Everett <nik9000@gmail.com> Date: Thu Jun 2 14:20:11 2016 -0400 Cleanup after merge from master commit9c9a1deb00
Author: Nik Everett <nik9000@gmail.com> Date: Thu Jun 2 14:09:14 2016 -0400 Breaking changes notes commit1c3e64ae06
Merge:9e63ad6
f67e580
Author: Nik Everett <nik9000@gmail.com> Date: Thu Jun 2 14:00:05 2016 -0400 Merge branch 'master' into block_until_refresh2 commit9e63ad6de5
Author: Nik Everett <nik9000@gmail.com> Date: Thu Jun 2 13:21:27 2016 -0400 Test for TransportWriteAction commit522ecb59d3
Author: Nik Everett <nik9000@gmail.com> Date: Thu Jun 2 10:30:18 2016 -0400 Document deprecation commit0cd67b947f
Author: Nik Everett <nik9000@gmail.com> Date: Thu Jun 2 10:26:23 2016 -0400 Deprecate setRefresh(boolean) Users should use `setRefresh(RefreshPolicy)` instead. commitaeb1be3f2c
Author: Nik Everett <nik9000@gmail.com> Date: Thu Jun 2 10:12:27 2016 -0400 Remove checkstyle suppression It is fixed commit00d09a9caa
Author: Nik Everett <nik9000@gmail.com> Date: Thu Jun 2 10:08:28 2016 -0400 Improve comment commit788164b898
Author: Nik Everett <nik9000@gmail.com> Date: Thu Jun 2 10:01:01 2016 -0400 S/ReplicatedWriteResponse/WriteResponse/ Now it lines up with WriteRequest. commitb74cf3fe77
Author: Nik Everett <nik9000@gmail.com> Date: Wed Jun 1 18:27:52 2016 -0400 Preserve `?refresh` behavior `?refresh` means the same things as `?refresh=true`. commit30f972bdae
Author: Nik Everett <nik9000@gmail.com> Date: Wed Jun 1 17:39:05 2016 -0400 Handle hanging documents If a document is added to the index during a refresh we weren't properly firing its refresh listener. This happened because the way we detect whether a refresh makes something visible or not is imperfect. It is ok because it always errs on the side of thinking that something isn't yet visible. So when a document arrives during a refresh the refresh listeners won't think it made it into a refresh when, often, it does. The way we work around this is by telling Elasticsearch that it ought to trigger a refresh if there are any pending refresh listeners even if there aren't pending documents to update. Lucene short circuits the refresh so it doesn't take that much effort, but the refresh listeners still get the signal that a refresh has come in and they still pick up the change and notify the listener. This means that the time that a listener can wait is actually slightly longer than the refresh interval. commitd523b5702b
Author: Nik Everett <nik9000@gmail.com> Date: Wed Jun 1 14:34:01 2016 -0400 Explain Integer.MAX_VALUE commit4ffb7c0e95
Author: Nik Everett <nik9000@gmail.com> Date: Wed Jun 1 14:27:39 2016 -0400 Fire all refresh listeners in a single thread Rather than queueing a runnable each. commit19606ec3bb
Author: Nik Everett <nik9000@gmail.com> Date: Wed Jun 1 14:09:52 2016 -0400 Assert translog ordering commit6bb4e5c75e
Author: Nik Everett <nik9000@gmail.com> Date: Wed Jun 1 13:17:44 2016 -0400 Support null RefreshListeners in InternalEngine Just skip using it. commit74be1480d6
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 31 18:02:03 2016 -0400 Move funny ShardInfo hack for bulk into bulk This should make it easier to understand because it is closer to where it matters.... commit2b771f8dab
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 31 17:39:46 2016 -0400 Pull listener out into an inner class with javadoc and stuff commit058481ad72
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 31 17:33:42 2016 -0400 Fix javadoc links commitd2123b1cab
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 31 17:28:09 2016 -0400 Make more stuff final commit8453fc4f78
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 31 17:26:48 2016 -0400 Javadoc commitfb16d2fc70
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 31 16:14:48 2016 -0400 Rewrite refresh docs commit5797d1b1c4
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 31 15:02:34 2016 -0400 Fix forced_refresh flag It wasn't being set. commit43ce50a1de
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 31 14:02:56 2016 -0400 Delay translog sync and flush until after refresh The sync might have occurred for us during the refresh so we have less work to do. Maybe. commitbb2739202e
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 31 13:08:08 2016 -0400 Remove duplication in WritePrimaryResult and WriteReplicaResult commit2f579f89b4
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 31 12:19:05 2016 -0400 Clean up registration of RefreshListeners commit87ab6e60ca
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 31 11:28:30 2016 -0400 Shorten lock time in RefreshListeners Also use null to represent no listeners rather than an empty list. This saves allocating a new ArrayList every refresh cycle on every index. commit0d49d9c572
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 24 10:46:18 2016 -0400 Flip relationship between RefreshListeners and Engine Now RefreshListeners comes to Engine from EngineConfig. commitb2704b8a39
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 24 09:37:58 2016 -0400 Remove unused imports Maybe I added them? commit04343a2264
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 24 09:37:52 2016 -0400 Javadoc commitda1e765678
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 24 09:26:35 2016 -0400 Reply with non-null Also move the fsync and flush to before the refresh listener stuff. commit5d8eecd0d9
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 24 08:58:47 2016 -0400 Remove funky synchronization in AsyncReplicaAction commit1ec71eea0f
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 24 08:01:14 2016 -0400 s/LinkedTransferQueue/ArrayList/ commit7da36a4cee
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 24 07:46:38 2016 -0400 More cleanup for RefreshListeners commit957e9b7700
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 24 07:34:13 2016 -0400 /Consumer<Runnable>/Executor/ commit4d8bf5d4a7
Author: Nik Everett <nik9000@gmail.com> Date: Mon May 23 22:20:42 2016 -0400 explain commit15d948a348
Author: Nik Everett <nik9000@gmail.com> Date: Mon May 23 22:17:59 2016 -0400 Better.... commitdc28951d02
Author: Nik Everett <nik9000@gmail.com> Date: Mon May 23 21:09:20 2016 -0400 Javadocs and compromises commit8eebaa89c0
Author: Nik Everett <nik9000@gmail.com> Date: Mon May 23 20:52:49 2016 -0400 Take boaz's changes to their logic conclusion and unbreak important stuff like bulk commit7056b96ea4
Author: Nik Everett <nik9000@gmail.com> Date: Mon May 23 15:49:32 2016 -0400 Patch from boaz commit87be7eaed0
Author: Nik Everett <nik9000@gmail.com> Date: Mon May 23 15:49:13 2016 -0400 Revert "Move async parts of replica operation outside of the lock" This reverts commit13807ad10b
. commit13807ad10b
Author: Nik Everett <nik9000@gmail.com> Date: Fri May 20 22:53:15 2016 -0400 Move async parts of replica operation outside of the lock commitb8cadcef56
Author: Nik Everett <nik9000@gmail.com> Date: Fri May 20 16:17:20 2016 -0400 Docs commit91149e0580
Author: Nik Everett <nik9000@gmail.com> Date: Fri May 20 15:17:40 2016 -0400 Finally! commit1ff50c2faf
Author: Nik Everett <nik9000@gmail.com> Date: Fri May 20 15:01:53 2016 -0400 Remove Translog#lastWriteLocation I wasn't being careful enough with locks so it wasn't right anyway. Instead this builds a synthetic Tranlog.Location when you call getWriteLocation with much more relaxed equality guarantees. Rather than being equal to the last Translog.Location returned it is simply guaranteed to be greater than the last translog returned and less than the next. commit55596ea68b
Author: Nik Everett <nik9000@gmail.com> Date: Fri May 20 14:40:06 2016 -0400 Remove listener from shardOperationOnPrimary Create instead asyncShardOperationOnPrimary which is called after all of the replica operations are started to handle any async operations. commit3322e26211
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 17 17:20:02 2016 -0400 Increase default maximum number of listeners to 1000 commit88171a8322
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 17 16:40:57 2016 -0400 Rename test commit179c27c4f8
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 17 16:35:27 2016 -0400 Move refresh listeners into their own class They still live at the IndexShard level but they live on their own in RefreshListeners which interacts with IndexShard using a couple of callbacks and a registration method. This lets us test the listeners without standing up an entire IndexShard. We still test the listeners against an InternalEngine, because the interplay between InternalEngine, Translog, and RefreshListeners is complex and important to get right. commitd8926d5fc1
Author: Nik Everett <nik9000@gmail.com> Date: Tue May 17 11:02:38 2016 -0400 Move refresh listeners into IndexShard commitdf91cde398
Author: Nik Everett <nik9000@gmail.com> Date: Mon May 16 16:01:03 2016 -0400 unused import commit066da45b08
Author: Nik Everett <nik9000@gmail.com> Date: Mon May 16 15:54:11 2016 -0400 Remove RefreshListener interface Just pass a Translog.Location and a Consumer<Boolean> when registering. commitb971d6d330
Author: Nik Everett <nik9000@gmail.com> Date: Mon May 16 14:41:06 2016 -0400 Docs for setForcedRefresh commit6c43be821e
Author: Nik Everett <nik9000@gmail.com> Date: Mon May 16 14:34:39 2016 -0400 Rename refresh setter and getter commite61b7391f9
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 22:48:09 2016 -0400 Trigger listeners even when there is no refresh Each refresh gives us an opportunity to pick up any listeners we may have left behind. commit0c9b047708
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 20:30:06 2016 -0400 REST commit8250343240
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 19:34:22 2016 -0400 Switch to estimated count We don't need a linear time count of the number of listeners - a volatile variable is good enough to guess. It probably undercounts more than it overcounts but it isn't a huge problem. commitbd531167fe
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 18:21:02 2016 -0400 Don't try and set forced refresh on bulk items without a response NullPointerExceptions are bad. If the entire request fails then the user has worse problems then "did these force a refresh". commitbcfded1151
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 18:14:20 2016 -0400 Replace LinkedList and synchronized with LinkedTransferQueue commit8a80cc70a7
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 17:38:24 2016 -0400 Support for update commit1f36966742
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 15:46:06 2016 -0400 Cleanup translog tests commit8d121bf35e
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 15:40:53 2016 -0400 Cleanup listener implementation Much more testing too! commit2058f4a808
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 11:45:55 2016 -0400 Pass back information about whether we refreshed commite445cb0cb9
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 11:03:31 2016 -0400 Javadoc commit611cbeeaeb
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 11:01:40 2016 -0400 Move ReplicationResponse now it is in the same package as its request commit9919758b64
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 11:00:14 2016 -0400 Oh boy that wasn't working commit247cb483c4
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 10:29:37 2016 -0400 Basic block_until_refresh exposed to java client and basic "is it plugged in" style tests. commit46c855c997
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 10:11:10 2016 -0400 Move test to own class commita5ffd892d0
Author: Nik Everett <nik9000@gmail.com> Date: Mon Apr 25 07:44:25 2016 -0400 WIP commit213bebb6ec
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 21:35:52 2016 -0400 Add refresh listeners commita2bc7f30e6
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 21:11:55 2016 -0400 Return last written location from refresh commit85033a8755
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 20:28:21 2016 -0400 Never reply to replica actions while you have the operation lock This last thing was causing periodic test failures because we were replying while we had the operation lock. Now, we probably could get away with that in most cases but the tests don't like it and it isn't a good idea to do network io while you have a lock anyway. So this prevents it. commit1f25cf35e7
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 19:56:18 2016 -0400 Cleanup commit52c5f7c3f0
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 19:33:00 2016 -0400 Add a listener to shard operations commit5b142dc331
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 18:03:52 2016 -0400 Cleanup commit3d22b2d7ce
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 17:59:55 2016 -0400 Push the listener into shardOperationOnPrimary commit34b378943b
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 17:48:47 2016 -0400 Doc commitb42b8da968
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 17:45:40 2016 -0400 Don't finish early if the primary finishes early We use a "fake" pending shard that we resolve when the replicas have all started. commit0fc045b56e
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 17:30:06 2016 -0400 Make performOnPrimary asyncS Instead of returning Tuple<Response, ReplicaRequest> it returns ReplicaRequest and takes a ActionListener<Response> as an argument. We call the listener immediately to preserve backwards compatibility for now. commit80119b9a26
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 16:51:53 2016 -0400 Factor out common code in shardOperationOnPrimary commit0642083676
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 16:32:29 2016 -0400 Factor out common code from shardOperationOnReplica commit8bdc415fed
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 16:23:28 2016 -0400 Create ReplicatedMutationRequest Superclass for index, delete, and bulkShard requests. commit0f8fa846a2
Author: Nik Everett <nik9000@gmail.com> Date: Fri Apr 22 16:10:30 2016 -0400 Create TransportReplicatedMutationAction It is the superclass of replication actions that mutate data: index, delete, and shardBulk. shardFlush and shardRefresh are replication actions but they do not extend TransportReplicatedMutationAction because they don't change the data, only shuffle it around.
311 lines
13 KiB
Text
311 lines
13 KiB
Text
|
|
|
|
|
|
[[breaking_50_java_api_changes]]
|
|
=== Java API changes
|
|
|
|
==== Count api has been removed
|
|
|
|
The deprecated count api has been removed from the Java api, use the search api instead and set size to 0.
|
|
|
|
The following call
|
|
|
|
[source,java]
|
|
-----
|
|
client.prepareCount(indices).setQuery(query).get();
|
|
-----
|
|
|
|
can be replaced with
|
|
|
|
[source,java]
|
|
-----
|
|
client.prepareSearch(indices).setSource(new SearchSourceBuilder().size(0).query(query)).get();
|
|
-----
|
|
|
|
==== Suggest api has been removed
|
|
|
|
The suggest api has been removed from the Java api, use the suggest option in search api, it has been optimized
|
|
for suggest-only request.
|
|
|
|
The following call
|
|
|
|
[source,java]
|
|
-----
|
|
client.prepareSuggest(indices).addSuggestion("foo", SuggestBuilders.completionSuggestion("field").text("s")).get();
|
|
-----
|
|
|
|
can be replaced with
|
|
|
|
[source,java]
|
|
-----
|
|
client.prepareSearch(indices).suggest(new SuggestBuilder().addSuggestion("foo", SuggestBuilders.completionSuggestion("field").text("s"))).get();
|
|
-----
|
|
|
|
==== Elasticsearch will no longer detect logging implementations
|
|
|
|
Elasticsearch now logs only to log4j 1.2. Previously if log4j wasn't on the
|
|
classpath it made some effort to degrade to slf4j or java.util.logging. Now it
|
|
will fail to work without the log4j 1.2 api. The log4j-over-slf4j bridge ought
|
|
to work when using the java client, as should log4j 2's log4j-1.2-api. The
|
|
Elasticsearch server now only supports log4j as configured by `logging.yml`
|
|
and will fail if log4j isn't present.
|
|
|
|
==== Groovy dependencies
|
|
|
|
In previous versions of Elasticsearch, the Groovy scripting capabilities
|
|
depended on the `org.codehaus.groovy:groovy-all` artifact. In addition
|
|
to pulling in the Groovy language, this pulls in a very large set of
|
|
functionality, none of which is needed for scripting within
|
|
Elasticsearch. Aside from the inherent difficulties in managing such a
|
|
large set of dependencies, this also increases the surface area for
|
|
security issues. This dependency has been reduced to the core Groovy
|
|
language `org.codehaus.groovy:groovy` artifact.
|
|
|
|
==== DocumentAlreadyExistsException removed
|
|
|
|
`DocumentAlreadyExistsException` is removed and a `VersionConflictException` is thrown instead (with a better
|
|
error description). This will influence code that use the `IndexRequest.opType()` or `IndexRequest.create()`
|
|
to index a document only if it doesn't already exist.
|
|
|
|
==== Changes to Query Builders
|
|
|
|
===== BoostingQueryBuilder
|
|
|
|
Removed setters for mandatory positive/negative query. Both arguments now have
|
|
to be supplied at construction time already and have to be non-null.
|
|
|
|
===== SpanContainingQueryBuilder
|
|
|
|
Removed setters for mandatory big/little inner span queries. Both arguments now have
|
|
to be supplied at construction time already and have to be non-null. Updated
|
|
static factory methods in QueryBuilders accordingly.
|
|
|
|
===== SpanOrQueryBuilder
|
|
|
|
Making sure that query contains at least one clause by making initial clause mandatory
|
|
in constructor.
|
|
Renaming method to add clauses from `clause(SpanQueryBuilder)` to `addClause(SpanQueryBuilder)`.
|
|
|
|
===== SpanNearQueryBuilder
|
|
|
|
Removed setter for mandatory slop parameter, needs to be set in constructor now. Also
|
|
making sure that query contains at least one clause by making initial clause mandatory
|
|
in constructor. Updated the static factory methods in QueryBuilders accordingly.
|
|
Renaming method to add clauses from `clause(SpanQueryBuilder)` to `addClause(SpanQueryBuilder)`.
|
|
|
|
===== SpanNotQueryBuilder
|
|
|
|
Removed setter for mandatory include/exclude span query clause, needs to be set in constructor now.
|
|
Updated the static factory methods in QueryBuilders and tests accordingly.
|
|
|
|
===== SpanWithinQueryBuilder
|
|
|
|
Removed setters for mandatory big/little inner span queries. Both arguments now have
|
|
to be supplied at construction time already and have to be non-null. Updated
|
|
static factory methods in QueryBuilders accordingly.
|
|
|
|
===== WrapperQueryBuilder
|
|
|
|
Removed `wrapperQueryBuilder(byte[] source, int offset, int length)`. Instead simply
|
|
use `wrapperQueryBuilder(byte[] source)`. Updated the static factory methods in
|
|
QueryBuilders accordingly.
|
|
|
|
===== QueryStringQueryBuilder
|
|
|
|
Removed ability to pass in boost value using `field(String field)` method in form e.g. `field^2`.
|
|
Use the `field(String, float)` method instead.
|
|
|
|
===== Operator
|
|
|
|
Removed the enums called `Operator` from `MatchQueryBuilder`, `QueryStringQueryBuilder`,
|
|
`SimpleQueryStringBuilder`, and `CommonTermsQueryBuilder` in favour of using the enum
|
|
defined in `org.elasticsearch.index.query.Operator` in an effort to consolidate the
|
|
codebase and avoid duplication.
|
|
|
|
===== queryName and boost support
|
|
|
|
Support for `queryName` and `boost` has been streamlined to all of the queries. That is
|
|
a breaking change till queries get sent over the network as serialized json rather
|
|
than in `Streamable` format. In fact whenever additional fields are added to the json
|
|
representation of the query, older nodes might throw error when they find unknown fields.
|
|
|
|
===== InnerHitsBuilder
|
|
|
|
InnerHitsBuilder now has a dedicated addParentChildInnerHits and addNestedInnerHits methods
|
|
to differentiate between inner hits for nested vs. parent / child documents. This change
|
|
makes the type / path parameter mandatory.
|
|
|
|
===== MatchQueryBuilder
|
|
|
|
Moving MatchQueryBuilder.Type and MatchQueryBuilder.ZeroTermsQuery enum to MatchQuery.Type.
|
|
Also reusing new Operator enum.
|
|
|
|
===== MoreLikeThisQueryBuilder
|
|
|
|
Removed `MoreLikeThisQueryBuilder.Item#id(String id)`, `Item#doc(BytesReference doc)`,
|
|
`Item#doc(XContentBuilder doc)`. Use provided constructors instead.
|
|
|
|
Removed `MoreLikeThisQueryBuilder#addLike` in favor of texts and/or items being provided
|
|
at construction time. Using arrays there instead of lists now.
|
|
|
|
Removed `MoreLikeThisQueryBuilder#addUnlike` in favor to using the `unlike` methods
|
|
which take arrays as arguments now rather than the lists used before.
|
|
|
|
The deprecated `docs(Item... docs)`, `ignoreLike(Item... docs)`,
|
|
`ignoreLike(String... likeText)`, `addItem(Item... likeItems)` have been removed.
|
|
|
|
===== GeoDistanceQueryBuilder
|
|
|
|
Removing individual setters for lon() and lat() values, both values should be set together
|
|
using point(lon, lat).
|
|
|
|
===== GeoDistanceRangeQueryBuilder
|
|
|
|
Removing setters for to(Object ...) and from(Object ...) in favour of the only two allowed input
|
|
arguments (String, Number). Removing setter for center point (point(), geohash()) because parameter
|
|
is mandatory and should already be set in constructor.
|
|
Also removing setters for lt(), lte(), gt(), gte() since they can all be replaced by equivalent
|
|
calls to to/from() and inludeLower()/includeUpper().
|
|
|
|
===== GeoPolygonQueryBuilder
|
|
|
|
Require shell of polygon already to be specified in constructor instead of adding it pointwise.
|
|
This enables validation, but makes it necessary to remove the addPoint() methods.
|
|
|
|
===== MultiMatchQueryBuilder
|
|
|
|
Moving MultiMatchQueryBuilder.ZeroTermsQuery enum to MatchQuery.ZeroTermsQuery.
|
|
Also reusing new Operator enum.
|
|
|
|
Removed ability to pass in boost value using `field(String field)` method in form e.g. `field^2`.
|
|
Use the `field(String, float)` method instead.
|
|
|
|
===== MissingQueryBuilder
|
|
|
|
The MissingQueryBuilder which was deprecated in 2.2.0 is removed. As a replacement use ExistsQueryBuilder
|
|
inside a mustNot() clause. So instead of using `new ExistsQueryBuilder(name)` now use
|
|
`new BoolQueryBuilder().mustNot(new ExistsQueryBuilder(name))`.
|
|
|
|
===== NotQueryBuilder
|
|
|
|
The NotQueryBuilder which was deprecated in 2.1.0 is removed. As a replacement use BoolQueryBuilder
|
|
with added mustNot() clause. So instead of using `new NotQueryBuilder(filter)` now use
|
|
`new BoolQueryBuilder().mustNot(filter)`.
|
|
|
|
===== TermsQueryBuilder
|
|
|
|
Remove the setter for `termsLookup()`, making it only possible to either use a TermsLookup object or
|
|
individual values at construction time. Also moving individual settings for the TermsLookup (lookupIndex,
|
|
lookupType, lookupId, lookupPath) to the separate TermsLookup class, using constructor only and moving
|
|
checks for validation there. Removed `TermsLookupQueryBuilder` in favour of `TermsQueryBuilder`.
|
|
|
|
===== FunctionScoreQueryBuilder
|
|
|
|
`add` methods have been removed, all filters and functions must be provided as constructor arguments by
|
|
creating an array of `FunctionScoreQueryBuilder.FilterFunctionBuilder` objects, containing one element
|
|
for each filter/function pair.
|
|
|
|
`scoreMode` and `boostMode` can only be provided using corresponding enum members instead
|
|
of string values: see `FilterFunctionScoreQuery.ScoreMode` and `CombineFunction`.
|
|
|
|
`CombineFunction.MULT` has been renamed to `MULTIPLY`.
|
|
|
|
===== IdsQueryBuilder
|
|
|
|
For simplicity, only one way of adding the ids to the existing list (empty by default) is left: `addIds(String...)`
|
|
|
|
===== ShapeBuilders
|
|
|
|
`InternalLineStringBuilder` is removed in favour of `LineStringBuilder`, `InternalPolygonBuilder` in favour of PolygonBuilder` and `Ring` has been replaced with `LineStringBuilder`. Also the abstract base classes `BaseLineStringBuilder` and `BasePolygonBuilder` haven been merged with their corresponding implementations.
|
|
|
|
===== RescoreBuilder
|
|
|
|
`RecoreBuilder.Rescorer` was merged with `RescoreBuilder`, which now is an abstract superclass. QueryRescoreBuilder currently is its only implementation.
|
|
|
|
===== PhraseSuggestionBuilder
|
|
|
|
The inner DirectCandidateGenerator class has been moved out to its own class called DirectCandidateGeneratorBuilder.
|
|
|
|
===== SortBuilders
|
|
|
|
The `sortMode` setter in `FieldSortBuilder`, `GeoDistanceSortBuilder` and `ScriptSortBuilder` now
|
|
accept a `SortMode` enum instead of a String constant. Also the getter returns the same enum type.
|
|
|
|
===== SuggestBuilder
|
|
|
|
The `setText` method has been changed to `setGlobalText` to make the intent more clear, and a `getGlobalText` method has been added.
|
|
|
|
The `addSuggestion` method now required the user specified suggestion name, previously used in the ctor of each suggestion.
|
|
|
|
===== SuggestionBuilder
|
|
|
|
The `field` setter has been deleted. Instead the field name needs to be specified as constructor argument.
|
|
|
|
==== SearchSourceBuilder
|
|
|
|
All methods which take an `XContentBuilder`, `BytesReference` `Map<String, Object>` or `bytes[]` have been removed in favor of providing the
|
|
relevant builder object for that feature (e.g. `HighlightBuilder`, `AggregationBuilder`, `SuggestBuilder`) . This means that all search requests
|
|
can now be validated at call time which results in much clearer errors.
|
|
|
|
The `defaultResourceWindowSize(int)` method has been removed. The window size should be set explicitly on all `RescoreBuilder` objects.
|
|
|
|
==== SearchRequestBuilder
|
|
|
|
All methods which take an `XContentBuilder`, `BytesReference` `Map<String, Object>` or `bytes[]` have been removed in favor of providing the
|
|
relevant builder object for that feature (e.g. `HighlightBuilder`, `AggregationBuilder`, `SuggestBuilder`) . This means that all search requests
|
|
can now be validated at call time which results in much clearer errors.
|
|
|
|
All highlighter methods have been removed in favor of a single `highlighter(HighlightBuilder)` method.
|
|
|
|
The `setExtraSource(SearchSourceBuilder)` method has been removed.
|
|
|
|
The `setTemplateSource(String)` and `setTemplateSource(BytesReference)` methods have been removed. Use `setTemplate(Template)` instead.
|
|
|
|
`setRescorer(Rescorer)` and `setRescorer(Rescorer, int)` have been removed infavor of `setRescorer(RescoreBuilder)` and `setRescorer(RescoreBuilder, int)`
|
|
|
|
==== SearchRequest
|
|
|
|
All `template` methods have been removed in favor of a single `template(Template)` method.
|
|
|
|
All `source` methods have been removed in favor of a single `source(SearchSourceBuilder)` method. This means that all search requests can now be validated
|
|
at call time which results in much clearer errors.
|
|
|
|
All `extraSource` methods have been removed.
|
|
|
|
==== SearchResponse
|
|
|
|
Sort values for `string` fields are now return as `java.lang.String` objects rather than `org.elasticsearch.common.text.Text`.
|
|
|
|
==== AggregationBuilder
|
|
|
|
All methods which take an `XContentBuilder`, `BytesReference` `Map<String, Object>` or `bytes[]` have been removed in favor of providing the
|
|
relevant builder object (i.e. `subAggregation(AggregationBuilder)` or `subAggregation(PipelineAggregationBuilder)`). This means that all
|
|
requests can now be validated at call time which results in much clearer errors.
|
|
|
|
==== ValidateQueryRequest
|
|
|
|
`source(QuerySourceBuilder)`, `source(Map)`, `source(XContentBuilder)`, `source(String)`, `source(byte[])`, `source(byte[], int, int)`,
|
|
`source(BytesReference)` and `source()` have been removed in favor of using `query(QueryBuilder)` and `query()`
|
|
|
|
==== ValidateQueryRequestBuilder
|
|
|
|
`setSource()` methods have been removed in favor of using `setQuery(QueryBuilder)`
|
|
|
|
==== ExplainRequest
|
|
|
|
`source(QuerySourceBuilder)`, `source(Map)`, `source(BytesReference)` and `source()` have been removed in favor of using
|
|
`query(QueryBuilder)` and `query()`
|
|
|
|
==== ExplainRequestBuilder
|
|
|
|
The `setQuery(BytesReference)` method have been removed in favor of using `setQuery(QueryBuilder)`
|
|
|
|
=== ClusterStatsResponse
|
|
|
|
Removed the `getMemoryAvailable` method from `OsStats`, which could be previously accessed calling
|
|
`clusterStatsResponse.getNodesStats().getOs().getMemoryAvailable()`.
|
|
|
|
=== setRefresh(boolean) has been deprecated
|
|
|
|
`setRefresh(boolean)` has been deprecated in favor of `setRefreshPolicy(RefreshPolicy)` because there
|
|
are now three options. It will be removed in 5.0.
|