Compressor detection can only be called on some ……
4003 ワード
今日書かれたESクライアントテストのファイルの中の1つの方法が間違っています.方法体は以下の通りです.
エラーの内容は以下の通りです.
ここでこの異常を起こしたのは、伝達されたパラメータjsonArrayのフォーマットが間違っているためです.jsonArrayを印刷しました.フォーマットは以下の通りです.
正しいフォーマットは次のとおりです.
従来の「[」スイッチのjsonArrayを昨年「[」に変更しても、
同じように間違いを報告します.
public IndexResponse createIndex(String indexName, String type,
String jsonArray) {
IndexRequestBuilder builder = client.prepareIndex(indexName, type).setSource(jsonArray);
IndexResponse response = builder.execute().actionGet();
return response;
}
エラーの内容は以下の通りです.
Exception in thread "main" MapperParsingException[failed to parse]; nested: NotSerializableExceptionWrapper[not_x_content_exception: Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes];
at org.elasticsearch.index.mapper.DocumentParser.parseDocument(DocumentParser.java:154)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:309)
at org.elasticsearch.index.shard.IndexShard.prepareCreate(IndexShard.java:529)
at org.elasticsearch.index.shard.IndexShard.prepareCreateOnPrimary(IndexShard.java:506)
at org.elasticsearch.action.index.TransportIndexAction.prepareIndexOperationOnPrimary(TransportIndexAction.java:215)
at org.elasticsearch.action.index.TransportIndexAction.executeIndexRequestOnPrimary(TransportIndexAction.java:224)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:158)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:66)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryPhase.doRun(TransportReplicationAction.java:639)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived( TransportReplicationAction.java:279)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived( TransportReplicationAction.java:271)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:75)
at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run( Thread.java:745)
Caused by: NotSerializableExceptionWrapper[not_x_content_exception: Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes]
at org.elasticsearch.common.compress.CompressorFactory.compressor(CompressorFactory.java:85)
at org.elasticsearch.common.xcontent.XContentHelper.createParser(XContentHelper.java:50)
at org.elasticsearch.index.mapper.DocumentParser.parseDocument(DocumentParser.java:90)
... 17 more
ここでこの異常を起こしたのは、伝達されたパラメータjsonArrayのフォーマットが間違っているためです.jsonArrayを印刷しました.フォーマットは以下の通りです.
[{"name":"hui1","salary":10000.39982635574,"age":8},
{"name":"hui2","salary":10000.160206564933,"age":11},
{"name":"hui3","salary":10000.417013742277,"age":28},
{"name":"hui4","salary":10000.26786620842,"age":7}]
正しいフォーマットは次のとおりです.
{"name":"hui1","salary":10000.39982635574,"age":8}
従来の「[」スイッチのjsonArrayを昨年「[」に変更しても、
{"name":"hui1","salary":10000.39982635574,"age":8},
{"name":"hui2","salary":10000.160206564933,"age":11},
{"name":"hui3","salary":10000.417013742277,"age":28},
{"name":"hui4","salary":10000.26786620842,"age":7}
同じように間違いを報告します.