使用python在elasticsearch中嵌套类型映射

时间:2017-12-30 10:35:07

标签: python elasticsearch mapping

我正在尝试映射elasticsearch索引,但我一直收到嵌套类型的错误。

request_body = {
"setting": {
    "number_of_shards": 3,
    "number_of_replicas": 1
},

"mappings": {
    "examplecase": {
        "properties": {
            "id": {"index": "not_analyzed", "type": "string"},
            "source": {"index": "analyzed", "type": "string"},
            "categories": {"index": "analyzed", "type": "string"},
            "source_link": {"index": "analyzed", "type": "string"},
            "article_name": {"index": "analyzed", "type": "string"},
            "text": {"index": "analyzed", "type": "string"},
            "date": {"index": "analyzed", "type": "string"},
            "article_text": {"type": "nested", "properties":
                {"text":
                    {"type": "string"},
                 "paragraph_name": {"type": "string"}}
                },
            "language": {"index": "analyzed", "type": "string"}
        }
    }
}
}
es.indices.create(index="articles", body=request_body)

我一直收到这个错误:

 'illegal_argument_exception', "object mapping [article_text] can't be 
 changed from nested to non-nested")

所有映射看起来都像在elasticsearch文档中,我不知道什么是错的。有没有人有任何想法?

0 个答案:

没有答案