0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

elasticsearch-rest-high-level-client の dependency を pom.xml に書くときの注意

Posted at

java プログラムからElasticsearcのREST API を呼び出すために、
公式サイトの説明のとおり、pom.xml に以下の記述を追加しました。

	<dependency>
	    <groupId>org.elasticsearch.client</groupId>
	    <artifactId>elasticsearch-rest-high-level-client</artifactId>
	    <version>6.3.1</version>
	</dependency>

ビルドは成功、実行すると以下の例外が発生しました。

java.lang.NoSuchMethodError: org.elasticsearch.action.search.MultiSearchResponse.fromXContext(Lorg/elasticsearch/common/xcontent/XContentParser;)Lorg/elasticsearch/action/search/MultiSearchResponse;
at java.lang.invoke.MethodHandleNatives.resolve(Native Method)
at java.lang.invoke.MemberName$Factory.resolve(MemberName.java:965)
at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:990)
at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:1387)
at java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:1739)
at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:442)
at org.elasticsearch.client.RestHighLevelClient.multiSearch(RestHighLevelClient.java:423)

調べたところ elasticsearch-rest-high-level-client-6.3.1.jar の依存ファイルとして elasticsearch-5.6.8.jar がダウンロードされていることが原因でした。

pom.xml に、明示的に以下の dependency を追加することで解決しました。

	<dependency>
	    <groupId>org.elasticsearch</groupId>
	    <artifactId>elasticsearch</artifactId>
	    <version>6.3.1</version>
	</dependency>
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?