2.X/8. Breaking Changes

v2.0-16. Java API changes

drscg 2017. 10. 12. 15:40

Transport API constructionedit

The TransportClient construction code has changed, it now uses the builder pattern. Instead of:

TransportClient 생성자 code가 변경되었다. 이제는 builder pattern을 사용한다. 아래 code 대신,

Settings settings = Settings.settingsBuilder()
        .put("cluster.name", "myClusterName").build();
Client client = new TransportClient(settings);

Use the following:

다음 code를 사용한다.

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:

transport client는 config file에서 설정을 load하는하는 것을 더 이상 지원하지 않는다. config file을 가지고 있다면, transport client를 생성하기 전에, 그 file을 load하여 설정할 수 있다.

Settings settings = Settings.settingsBuilder()
        .loadFromPath(pathToYourSettingsFile).build();
Client client = TransportClient.builder().settings(settings).build();

Exception are only thrown on total failureedit

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.

이전 버전에서는, 어떤 shard라도 request를 실행하는데 실패하면, 많은 API가 exception을 발생시켰다. 이제는 모든 shard가 request에 실패했을 경우에만, exception이 발생한다. 이들 API의 response는 실패를 확인할 수 있도록 getShardFailures method를 가질 것이다.

IndexMissingException removed.edit

Use IndexNotFoundException instead.

대신 IndexNotFoundException 을 사용하자.

Automatically thread client listenersedit

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 to debug.

이전 버전에서는, client side에서 많은(heavy) 연산을 할 경우, IO thread가 block되지 않도록, 사용자는 request listener threads를 true 로 설정해야만 했다. 이것은 사용자들에게 성가신 작업이고, 결국 debug가 매우 어려워진다.

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.

2.0에서, Elasticsearch는 client가 node 또는 transport client인 경우, client에서 사용되는 listener는 자동으로 thread 처리된다. threading은 더 이상 수동으로 설정할 수 없다.

Query/filter refactoringedit

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 QueryBuilder instead.

org.elasticsearch.index.queries.FilterBuilders 는 query와 filter 병합 작업의 일부로써 제거되었다. 이들 filter는 QueryBuilders 에서 동일한 이름으로 이용할 수 있다. FilterBuilder 를 사용하는 모든 method는 이제, QueryBuilder 를 대신 사용할 수 있다.

In addition some query builders have been removed or renamed:

추가로, 몇몇 query builder는 제거되거나 이름이 변경되었다.

  • commonTerms(...) renamed with commonTermsQuery(...)
  • queryString(...) renamed with queryStringQuery(...)
  • simpleQueryString(...) renamed with simpleQueryStringQuery(...)
  • textPhrase(...) removed
  • textPhrasePrefix(...) removed
  • textPhrasePrefixQuery(...) removed
  • filtered(...) removed. Use filteredQuery(...) instead.
  • inQuery(...) removed. Use termsQuery(...) instead.

GetIndexRequestedit

GetIndexRequest.features() now returns an array of Feature Enums instead of an array of String values.

GetIndexRequest.features() `는 String 값의 array 대신 Feature Enums 의 array를 return한다.

The following deprecated methods have been removed:

다음의 deprecate된 method는 제거되었다.

  • GetIndexRequest.addFeatures(String[]) - Use GetIndexRequest.addFeatures(Feature[])instead
  • GetIndexRequest.features(String[]) - Use GetIndexRequest.features(Feature[]) instead.
  • GetIndexRequestBuilder.addFeatures(String[]) - UseGetIndexRequestBuilder.addFeatures(Feature[]) instead.
  • GetIndexRequestBuilder.setFeatures(String[]) - UseGetIndexRequestBuilder.setFeatures(Feature[]) instead.

BytesQueryBuilder removededit

The redundant BytesQueryBuilder has been removed in favour of the WrapperQueryBuilder internally.

내부적으로 WrapperQueryBuilder를 위하여 불필요한 BytesQueryBuilder는 제거되었다.

TermsQueryBuilder execution removededit

The TermsQueryBuilder#execution method has been removed as it has no effect, it is ignored by the corresponding parser.

아무런 효과도 없기 때문에 TermsQueryBuilder#execution method는 제거되었다. 그것은 해당하는 parser에 의해 무시된다.

ImmutableSettings removededit

Use Settings.builder() instead of ImmutableSettings.builder().

ImmutableSettings.builder() 대신 Settings.builder() 를 사용하자.

InetSocketTransportAddress removededit

Use InetSocketTransportAddress(InetSocketAddress address) instead of InetSocketTransportAddress(String, int). You can create an InetSocketAddress instance with InetSocketAddress(String, int). For example:

InetSocketTransportAddress(String, int) 대신에 InetSocketTransportAddress(InetSocketAddress address) 을 사용하자. InetSocketAddress(String, int) 을 가진 InetSocketAddress instance를 생성할 수 있다. 예를 들자면,

new InetSocketTransportAddress(new InetSocketAddress("127.0.0.1", 0));

Request Builders refactoringedit

An action parameter has been added to various request builders:

action parameter는 다양한 request builder에 추가되었다.

  • Instead of new SnapshotsStatusRequestBuilder(elasticSearchClient) use new SnapshotsStatusRequestBuilder(elasticSearchClient, SnapshotsStatusAction.INSTANCE).
  • Instead of new CreateSnapshotRequestBuilder(elasticSearchClient) use new CreateSnapshotRequestBuilder(elasticSearchClient, CreateSnapshotAction.INSTANCE).
  • Instead of new CreateIndexRequestBuilder(elasticSearchClient, index) use new CreateIndexRequestBuilder(elasticSearchClient, CreateIndexAction.INSTANCE, index).

Shading and package relocation removededit

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:

Elasticsearch는 자신의 종속성(dependency)을 감추고, package를 재배치하곤 했다. 더 이상 감추거나 재배치하지 않는다. 여러분이 import한 것을 원래의 package name으로 변경해야 할 것이다.

  • com.google.common was org.elasticsearch.common
  • com.carrotsearch.hppc was org.elasticsearch.common.hppc
  • jsr166e was org.elasticsearch.common.util.concurrent.jsr166e
  • com.fasterxml.jackson was org.elasticsearch.common.jackson
  • org.joda.time was org.elasticsearch.common.joda.time
  • org.joda.convert was org.elasticsearch.common.joda.convert
  • org.jboss.netty was org.elasticsearch.common.netty
  • com.ning.compress was org.elasticsearch.common.compress
  • com.github.mustachejava was org.elasticsearch.common.mustache
  • com.tdunning.math.stats was org.elasticsearch.common.stats
  • org.apache.commons.lang was org.elasticsearch.common.lang
  • org.apache.commons.cli was org.elasticsearch.common.cli.commons


'2.X > 8. Breaking Changes' 카테고리의 다른 글

v2.0-11. Index API changes  (0) 2017.10.13
v2.0-12. Snapshot and Restore changes  (0) 2017.10.13
v2.0-13. Plugin and packaging changes  (0) 2017.10.13
v2.0-14. Setting changes  (0) 2017.10.13
v2.0-15. Stats, info, and cat changes  (0) 2017.10.13