gpt4 book ai didi

elasticsearch - Elasticsearch mapper_parsing_exception 错误

转载 作者:行者123 更新时间:2023-12-05 07:23:17 24 4
gpt4 key购买 nike

我在 Elasticsearch 中创建了一个名为 test 的索引。索引映射如下:

{
"title": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"url": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
}
}

创建索引后,我在其中添加了以下文档:

 {
"title": "demo",
"url": {
"name": "tiger",
"age": 10
}
}

但我收到以下错误:

{"mapper_parsing_exception","reason":"failed to parse field [url] of type [text]"}

谁能帮我解决这个问题?

最佳答案

如果您的文档如下所示:

{
"title": "demo",
"url": {
"name": "tiger",
"age": 10
}
}

那么您的映射需要如下所示,即 url 是一个包含 nameage 字段的对象:

{
"title": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"url": {
"properties": {
"name": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"age": {
"type": "integer"
}
}
}
}

关于elasticsearch - Elasticsearch mapper_parsing_exception 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56078277/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com