WARNING: Version 2.4 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
TransportClient construction code has changed, it now uses the builder
pattern. Instead of:
Settings settings = Settings.settingsBuilder() .put("cluster.name", "myClusterName").build(); Client client = new TransportClient(settings);
Use the following:
Settings settings = Settings.settingsBuilder() .put("cluster.name", "myClusterName").build(); Client client = TransportClient.builder().settings(settings).build();
The transport client also no longer supports loading settings from config files. If you have a config file, you can load it into settings yourself before constructing the transport client:
Settings settings = Settings.settingsBuilder() .loadFromPath(pathToYourSettingsFile).build(); Client client = TransportClient.builder().settings(settings).build();
Previously, many APIs would throw an exception if any shard failed to execute
the request. Now the exception is only thrown if all shards fail the request.
The responses for these APIs will always have a
getShardFailures method that
you can and should check for failures.
Previously, the user had to set request listener threads to
true when on the
client side in order not to block IO threads on heavy operations. This proved
to be very trappy for users, and ended up creating problems that are very hard
In 2.0, Elasticsearch automatically threads listeners that are used from the client when the client is a node client or a transport client. Threading can no longer be manually set.
org.elasticsearch.index.queries.FilterBuilders has been removed as part of the merge of
queries and filters. These filters are now available in
QueryBuilders with the same name.
All methods that used to accept a
FilterBuilder now accept a
In addition some query builders have been removed or renamed:
GetIndexRequest.features() now returns an array of Feature Enums instead of an array of String values.
The following deprecated methods have been removed:
The redundant BytesQueryBuilder has been removed in favour of the WrapperQueryBuilder internally.
TermsQueryBuilder#execution method has been removed as it has no effect, it is ignored by the
Settings.builder() instead of
InetSocketTransportAddress(InetSocketAddress address) instead of
You can create an InetSocketAddress instance with
InetSocketAddress(String, int). For example:
new InetSocketTransportAddress(new InetSocketAddress("127.0.0.1", 0));
action parameter has been added to various request builders:
new SnapshotsStatusRequestBuilder(elasticSearchClient, SnapshotsStatusAction.INSTANCE).
new CreateSnapshotRequestBuilder(elasticSearchClient, CreateSnapshotAction.INSTANCE).
new CreateIndexRequestBuilder(elasticSearchClient, index)use
new CreateIndexRequestBuilder(elasticSearchClient, CreateIndexAction.INSTANCE, index).
Elasticsearch used to shade its dependencies and to relocate packages. We no longer use shading or relocation. You might need to change your imports to the original package names: