Hi all,
I have a Java Maven project with:
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>2.4.2</version>
</dependency>
I run a simple prepareIndex, where source is an HashMap, no special field:
IndexResponse ir = client.prepareIndex(documentType.getIndexName(), documentType.getDocumentType(), Long.toString(2222222))
.setSource(source)
.get();
No problem here, ir.getShardInfo().getFailed() = 0, and my document is well indexed.
BUT, there is an error into the IndexResponse (I think it's when decoding the response):
IndexResponse[index=myindex,type=mydoc,id=2222222,version=11,created=false,shards=Error building toString out of XContent: com.fasterxml.jackson.core.JsonGenerationException: Can not write a field name, expecting a value
at com.fasterxml.jackson.core.JsonGenerator._reportError(JsonGenerator.java:1886)
at com.fasterxml.jackson.core.json.UTF8JsonGenerator.writeFieldName(UTF8JsonGenerator.java:235)
at org.elasticsearch.common.xcontent.json.JsonXContentGenerator.writeFieldName(JsonXContentGenerator.java:152)
at org.elasticsearch.common.xcontent.XContentBuilder.field(XContentBuilder.java:264)
at org.elasticsearch.common.xcontent.XContentBuilder.field(XContentBuilder.java:255)
at org.elasticsearch.common.xcontent.XContentBuilder.startObject(XContentBuilder.java:169)
at org.elasticsearch.action.ActionWriteResponse$ShardInfo.toXContent(ActionWriteResponse.java:147)
at org.elasticsearch.common.Strings.toString(Strings.java:1103)
at org.elasticsearch.common.Strings.toString(Strings.java:1089)
at org.elasticsearch.action.ActionWriteResponse$ShardInfo.toString(ActionWriteResponse.java:164)
at java.lang.String.valueOf(String.java:2849)
at java.lang.StringBuilder.append(StringBuilder.java:128)
at org.elasticsearch.action.index.IndexResponse.toString(IndexResponse.java:118)
...
]
I found here a solution pretty recent: http://stackoverflow.com/questions/39679400/elastic-search-bulk-index-java-api-not-working
Here is another same problem, but only solved in 5x version: https://github.com/elastic/elasticsearch/issues/20853
When I split dependencies, there is no more JsonGenerationException, but I wonder if it could be a problem to do not use the Jackson version "linked" to the Elasticsearch version.
So my question is simple : Should I stay with this error, or should I split dependencies ?
Thx,
Xavier