Elasticsearch:根映射定义具有不受支持的参数
Elasticsearch : Root mapping definition has unsupported parameter
我正在创建一种通过 Elasticsearch 和 Kibana 搜索泰语单词的方法。我有映射问题。
PUT test
{
"settings": {
"analysis": {
"analyzer": {
"trigrams": {
"tokenizer": "trigram_tokenizer",
"filter": [
"lowercase"
]
}
},
"tokenizer": {
"trigram_tokenizer": {
"type": "ngram",
"min_ngram": 3,
"max_ngram": 3,
"token_chars": []
}
}
}
},
"mappings": {
"true_name": {
"properties": {
"correct": { "type": "text", "analyzer": "trigrams" }
}
}
}
}
和这样的错误
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [true_name : {properties={correct={analyzer=trigrams, type=text}}}]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [true_name : {properties={correct={analyzer=trigrams, type=text}}}]",
"caused_by" : {
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [true_name : {properties={correct={analyzer=trigrams, type=text}}}]"
}
},
"status" : 400
}
映射类型已弃用。请参阅此 documentation 以了解有关删除映射类型的更多信息。
Indices created in Elasticsearch 6.0.0 or later may only contain a
single mapping type. Indices created in 5.x with multiple mapping
types will continue to function as before in Elasticsearch 6.x. Types
will be deprecated in APIs in Elasticsearch 7.0.0, and completely
removed in 8.0.0.
{
"settings": {
"analysis": {
"analyzer": {
"trigrams": {
"tokenizer": "trigram_tokenizer",
"filter": [
"lowercase"
]
}
},
"tokenizer": {
"trigram_tokenizer": {
"type": "ngram",
"min_ngram": 3,
"max_ngram": 3,
"token_chars": []
}
}
}
},
"mappings": { // note this
"properties": {
"correct": {
"type": "text",
"analyzer": "trigrams"
}
}
}
}
如果你的JSON文档是这样的:
{
"true_name": {
"correct": "mapping types deprecated"
}
}
那么索引映射将为-
{
"settings": {
"analysis": {
"analyzer": {
"trigrams": {
"tokenizer": "trigram_tokenizer",
"filter": [
"lowercase"
]
}
},
"tokenizer": {
"trigram_tokenizer": {
"type": "ngram",
"min_ngram": 3,
"max_ngram": 3,
"token_chars": []
}
}
}
},
"mappings": {
"properties": { // note this
"true_name": {
"properties": {
"correct": {
"type": "text",
"analyzer": "trigrams"
}
}
}
}
}
}
我正在创建一种通过 Elasticsearch 和 Kibana 搜索泰语单词的方法。我有映射问题。
PUT test
{
"settings": {
"analysis": {
"analyzer": {
"trigrams": {
"tokenizer": "trigram_tokenizer",
"filter": [
"lowercase"
]
}
},
"tokenizer": {
"trigram_tokenizer": {
"type": "ngram",
"min_ngram": 3,
"max_ngram": 3,
"token_chars": []
}
}
}
},
"mappings": {
"true_name": {
"properties": {
"correct": { "type": "text", "analyzer": "trigrams" }
}
}
}
}
和这样的错误
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [true_name : {properties={correct={analyzer=trigrams, type=text}}}]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [true_name : {properties={correct={analyzer=trigrams, type=text}}}]",
"caused_by" : {
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [true_name : {properties={correct={analyzer=trigrams, type=text}}}]"
}
},
"status" : 400
}
映射类型已弃用。请参阅此 documentation 以了解有关删除映射类型的更多信息。
Indices created in Elasticsearch 6.0.0 or later may only contain a single mapping type. Indices created in 5.x with multiple mapping types will continue to function as before in Elasticsearch 6.x. Types will be deprecated in APIs in Elasticsearch 7.0.0, and completely removed in 8.0.0.
{
"settings": {
"analysis": {
"analyzer": {
"trigrams": {
"tokenizer": "trigram_tokenizer",
"filter": [
"lowercase"
]
}
},
"tokenizer": {
"trigram_tokenizer": {
"type": "ngram",
"min_ngram": 3,
"max_ngram": 3,
"token_chars": []
}
}
}
},
"mappings": { // note this
"properties": {
"correct": {
"type": "text",
"analyzer": "trigrams"
}
}
}
}
如果你的JSON文档是这样的:
{
"true_name": {
"correct": "mapping types deprecated"
}
}
那么索引映射将为-
{
"settings": {
"analysis": {
"analyzer": {
"trigrams": {
"tokenizer": "trigram_tokenizer",
"filter": [
"lowercase"
]
}
},
"tokenizer": {
"trigram_tokenizer": {
"type": "ngram",
"min_ngram": 3,
"max_ngram": 3,
"token_chars": []
}
}
}
},
"mappings": {
"properties": { // note this
"true_name": {
"properties": {
"correct": {
"type": "text",
"analyzer": "trigrams"
}
}
}
}
}
}