Hi!
I try to create document via high level rest client with:
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("name", "Bob");
jsonMap.put("id", "123456");
IndexRequest indexRequest = new IndexRequest("lead").id("123456").source(jsonMap);
client.index(indexRequest, RequestOptions.DEFAULT);
But it throws a NoClassDefFoundError: org/apache/lucene/util/BytesRefIterator.
The elastic version is 7.3.2.
That's the elasticsearch dependency in my pom.
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>7.3.2</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.3.2</version>
</dependency>
The full stacktrace:
Exception in thread "Thread-20" java.lang.NoClassDefFoundError: org/apache/lucene/util/BytesRefIterator
at org.elasticsearch.action.index.IndexRequest.source(IndexRequest.java:397)
at org.elasticsearch.action.index.IndexRequest.source(IndexRequest.java:377)
at org.elasticsearch.action.index.IndexRequest.source(IndexRequest.java:365)
at com.sunyard.mdhome.elasticsearch.impl.MetadataDocumentBuilderImpl.createDocument(MetadataDocumentBuilderImpl.java:182)
at com.sunyard.mdhome.elasticsearch.impl.MetadataDocumentBuilderImpl.build(MetadataDocumentBuilderImpl.java:76)
at com.sunyard.mdhome.elasticsearch.impl.MetadataDocumentBuilderImpl.getPage(MetadataDocumentBuilderImpl.java:163)
at com.sunyard.mdhome.elasticsearch.impl.MetadataDocumentBuilderImpl.getSyncMetadata(MetadataDocumentBuilderImpl.java:121)
at com.sunyard.mdhome.thread.MetadataSyncThread.run(MetadataSyncThread.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.util.BytesRefIterator
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 9 more