Upsert嵌套文件抛出映射错误elasticsearch

时间:2014-07-30 16:13:17

标签: java elasticsearch

我正在尝试在更新期间进行upsert,但我不知道为什么我无法使用java API。

这是我的问题:

当我使用脚本时,我可以按预期更新我的文档:

esClientManager.getEsClient().prepareUpdate(index, type, id).setScript("ctx._source.location =" + json)

但是当我尝试使用setDoc方法在我收到错误后能够使用setDocAsUpsert时。以下是setDoc:

的请求
 esClientManager.getEsClient().prepareUpdate(index, type, id).setDoc("location", json).setDocAsUpsert(true);

ELasticsearch引发以下错误:

org.elasticsearch.index.mapper.MapperParsingException: object mapping for [type] tried to parse as object, but got EOF, has a concrete value been provided to it?
    at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:467)
    at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:515)
    at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:462)
    at org.elasticsearch.index.shard.service.InternalIndexShard.prepareCreate(InternalIndexShard.java:363)
    at org.elasticsearch.action.bulk.TransportShardBulkAction.shardIndexOperation(TransportShardBulkAction.java:406)
    at org.elasticsearch.action.bulk.TransportShardBulkAction.shardUpdateOperation(TransportShardBulkAction.java:501)
    at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:228)
    at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:556)
    at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:426)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

我正在更新的位置对象是一个嵌套文档,其中包含以下映射:

"properties": {
                "location": {
                    "type": "nested",
                    "properties":{
                        "point":{"type":"geo_point"}                
                    }
                }
            }

知道为什么它不起作用吗?

0 个答案:

没有答案