我使用的是elasticsearch版本2.1.1。当我尝试使用以下有效内容创建模式时,它会给出“不支持的参数”错误:
URL : http://localhost:9200/enron/mails/_mapping
Operation: PUT
Payload:
{
"enron": {
"properties": {
"message_id": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
},
"from": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
},
"to": {
"type": "string",
"index": "not_analyzed",
"store": "yes",
"multi_field": "yes"
},
"x_cc": {
"type": "string",
"index": "not_analyzed",
"store": "yes",
"multi_field": "yes"
},
"x_bcc": {
"type": "string",
"index": "not_analyzed",
"store": "yes",
"multi_field": "yes"
},
"date": {
"type": "date",
"index": "not_analyzed",
"store": "yes"
},
"subject": {
"type": "string",
"index": "analyzed",
"store": "yes"
},
"body": {
"type": "string",
"index": "analyzed",
"store": "yes"
}
}
}
}
错误消息:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [enron : {properties={message_id={type=string, index=not_analyzed, store=yes}, from={type=string, index=not_analyzed, store=yes}, to={type=string, index=not_analyzed, store=yes, multi_field=yes}, x_cc={type=string, index=not_analyzed, store=yes, multi_field=yes}, x_bcc={type=string, index=not_analyzed, store=yes, multi_field=yes}, date={type=date, index=not_analyzed, store=yes}, subject={type=string, index=analyzed, store=yes}, body={type=string, index=analyzed, store=yes}}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [enron : {properties={message_id={type=string, index=not_analyzed, store=yes}, from={type=string, index=not_analyzed, store=yes}, to={type=string, index=not_analyzed, store=yes, multi_field=yes}, x_cc={type=string, index=not_analyzed, store=yes, multi_field=yes}, x_bcc={type=string, index=not_analyzed, store=yes, multi_field=yes}, date={type=date, index=not_analyzed, store=yes}, subject={type=string, index=analyzed, store=yes}, body={type=string, index=analyzed, store=yes}}}]"
},
"status": 400
}
有人可以帮我识别错误吗?
答案 0 :(得分:7)
这有几个问题。您需要从有效负载中删除索引名称enron
。 ES 2.1中没有multi_field。您可以参考docs了解更多信息
这将有效
PUT enron/mails/_mapping
{
"properties": {
"message_id": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
},
"from": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
},
"to": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
},
"x_cc": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
},
"x_bcc": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
},
"date": {
"type": "date",
"index": "not_analyzed",
"store": "yes"
},
"subject": {
"type": "string",
"index": "analyzed",
"store": "yes"
},
"body": {
"type": "string",
"index": "analyzed",
"store": "yes"
}
}
}