ElasticSearch 解析映射失败
ElasticSearch Failed to parse mapping
我正在尝试使用 put 请求创建新索引 http://localhost:9200/songs
具有以下映射
{
"mappings": {
"songs": {
"properties": {
"artist_name": {
"type": "text"
},
"songs": {
"type": "nested",
"properties": {
"name": {
"type": "keyword"
},
"lyric": {
"type": "keyword"
}
}
}
}
}
}
}
Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [songs : {properties={artist_name={type=text}, songs={type=nested, properties={lyric={type=keyword}, name={type=keyword}}}}}]"
json 结构有效。我哪里错了?
您似乎使用的是 ES 版本 7,其中 type
已被弃用,如前所述 here:
将您的映射更改为以下,它应该可以工作。
PUT <your_index_name>
{
"mappings": {
"properties": {
"artist_name": {
"type": "text"
},
"songs": {
"type": "nested",
"properties": {
"name": {
"type": "keyword"
},
"lyric": {
"type": "keyword"
}
}
}
}
}
}
希望对您有所帮助!
我正在尝试使用 put 请求创建新索引 http://localhost:9200/songs 具有以下映射
{
"mappings": {
"songs": {
"properties": {
"artist_name": {
"type": "text"
},
"songs": {
"type": "nested",
"properties": {
"name": {
"type": "keyword"
},
"lyric": {
"type": "keyword"
}
}
}
}
}
}
}
Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [songs : {properties={artist_name={type=text}, songs={type=nested, properties={lyric={type=keyword}, name={type=keyword}}}}}]"
json 结构有效。我哪里错了?
您似乎使用的是 ES 版本 7,其中 type
已被弃用,如前所述 here:
将您的映射更改为以下,它应该可以工作。
PUT <your_index_name>
{
"mappings": {
"properties": {
"artist_name": {
"type": "text"
},
"songs": {
"type": "nested",
"properties": {
"name": {
"type": "keyword"
},
"lyric": {
"type": "keyword"
}
}
}
}
}
}
希望对您有所帮助!