elasticsearch - 如何检查弹性日志中的哪个字段解析错误

标签 elasticsearch

我在elasticsearch中的错误日志是这样的:

[2015-09-04 10:59:49,531][DEBUG][action.bulk              ] [baichebao-node-2] [questions][0] failed to execute bulk item (index) index {[questions][baichebao][AU-WS7qZwHwGnxdqIztg], source[_na_]}
org.elasticsearch.index.mapper.MapperParsingException: failed to parse
    at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:565)
    at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:493)
    at org.elasticsearch.index.shard.IndexShard.prepareCreate(IndexShard.java:466)
    at org.elasticsearch.action.bulk.TransportShardBulkAction.shardIndexOperation(TransportShardBulkAction.java:418)
    at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:148)
    at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase.performOnPrimary(TransportShardReplicationOperationAction.java:574)
    at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase$1.doRun(TransportShardReplicationOperationAction.java:440)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:36)
    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: org.elasticsearch.ElasticsearchParseException: Failed to derive xcontent
    at org.elasticsearch.common.xcontent.XContentFactory.xContent(XContentFactory.java:195)
    at org.elasticsearch.common.xcontent.XContentHelper.createParser(XContentHelper.java:75)
    at org.elasticsearch.common.xcontent.XContentHelper.createParser(XContentHelper.java:53)
    at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:507)
    ... 10 more

和我的映射是这样的:
{
            "mappings" : {
                "baichebao" : {
                    "dynamic" : false,
                    "_all" : { "enable" : false },
                    "_id" : {
                        "store" : true,
                        "path" : "id"
                    },
                    "properties" : {
                        "id" : {
                            "type" : "long"
                        },
                        "content" : {
                            "type" : "string",
                            "analyzer" : "ik_syno_smart"
                        },
                        "uid" : {
                            "type" : "integer"
                        },
                        "all_answer_count" : {
                            "type" : "integer"
                        },
                        "answer_users" : {
                            "type" : "integer"
                        },
                        "best_answer" : {
                            "type" : "long"
                        },
                        "status" : {
                            "type" : "short"
                        },
                        "created_at" : {
                            "type" : "long"
                        },
                        "distrust" : {
                            "type" : "short"
                        },
                        "is_expert" : {
                            "type" : "boolean"
                        },
                        "series_id" : {
                            "type" : "integer"
                        },
                        "is_closed" : {
                            "type" : "boolean"
                        },
                        "closed_at" : {
                            "type" : "long"
                        },
                        "tags" : {
                            "type" : "string"
                        },
                        "channel_type" : {
                            "type" : "integer"
                        },
                        "channel_sub_type" : {
                            "type" : "integer"
                        }
                    }
                }
            }
        }

但是我找不到哪个字段解析错误?

我该如何解决这个问题?

最佳答案

该错误通常表示通过检查前20个字节,无法将发送到elasticsearch的文档识别为JSON或SMILE文档。例如,如果在JSON文档中省略了前导“{”,则会出现此错误:

curl -XPUT localhost:9200/test/doc/1 -d 'I am not a json document'

或在有效的JSON前面加上20多个空格字符:
curl -XPUT localhost:9200/test/doc/1 -d '                    {"foo": "bar"}'

关于elasticsearch - 如何检查弹性日志中的哪个字段解析错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32389445/

相关文章:

elasticsearch - Elasticsearch在顶级聚合中包括其他字段

elasticsearch - 无法使用 elasticsearch 和 metricbeat 检索标准化 CPU 利用率百分比

elasticsearch - Timelion 语法不起作用

elasticsearch - 从日期时间字段的一部分创建新字段

elasticsearch - Elasticsearch自动完成无法正常工作

syntax - 如何在 ElasticSearch 1.0 的聚合范围查询中使用 doc_count

elasticsearch - Elasticsearch:如何允许多语言搜索?

Elasticsearch:如果类型更改,则忽略/不索引字段

elasticsearch ngram 分析器/tokenizer 不工作?

elasticsearch - 如何在NEST中使用多个索引分析器?