Elasticseach批量加载奇怪地缺少3个文档中的1个

时间:2017-02-22 15:45:03

标签: elasticsearch elasticsearch-2.0

我在https://www.elastic.co/guide/en/elasticsearch/guide/current/shingles.html

的带状疱疹示例后遇到了奇怪的问题

当我尝试索引该教程中的三个文档时,只有两个文档被编入索引,ID 3的文档从未编入索引。

张贴到http://elastic:9200/myIndex/page/_bulk的请求是:

{
"took": 18,
"errors": false,
"items": [
    {
        "index": {
            "_index": "myIndex",
            "_type": "page",
            "_id": "1",
            "_version": 1,
            "_shards": {
                "total": 1,
                "successful": 1,
                "failed": 0
            },
            "status": 201
        }
    },
    {
        "index": {
            "_index": "myIndex",
            "_type": "page",
            "_id": "2",
            "_version": 1,
            "_shards": {
                "total": 1,
                "successful": 1,
                "failed": 0
            },
            "status": 201
        }
    }
]}

但回应是:

{
"settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0,
    "analysis": {
        "filter": {
            "filter_shingle": {
                "type": "shingle",
                "max_shingle_size": 5,
                "min_shingle_size": 2,
                "output_unigrams": "false"
            },
            "filter_stop": {
                "type": "stop"
            }
        },
        "analyzer": {
            "analyzer_shingle": {
                "tokenizer": "standard",
                "filter": ["standard", "lowercase", "filter_stop", "filter_shingle"]
            }
        }
    }
},
"mappings": {
    "page": {
        "properties": {
            "text": {
                "type": "string",
                "index_options": "offsets",
                "analyzer": "standard",
                "fields": {
                    "shingles": {
                        "search_analyzer": "analyzer_shingle",
                        "analyzer": "analyzer_shingle",
                        "type": "string"
                    }
                }
            },
            "title": {
                "type": "string",
                "index_options": "offsets",
                "analyzer": "standard",
                "search_analyzer": "standard"
            }
        }
    }
}}

索引和映射定义:

{{1}}

1 个答案:

答案 0 :(得分:1)

批量发布文档时,您需要确保在最后一行之后添加换行符explained in the official docs

end
success