运行以下命令curl -XPUT localhost:9200/alpha/_mapping/gremlin -d @company_info_mapping.json
会返回带有400
消息的Root mapping definition has unsupported parameters
。
这是映射文件:
{
"settings": {
"index.mapping.ignore_malformed": true,
"analysis" : {
"index_analyzer": {
"my_index_analyzer" : {
"type": "custom",
"tokenizer" : "standard",
"filter" : ["lowercase", "mynGram"]
}
},
"search_analyzer": {
"my_search_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter" : ["standard", "lowercase", "mynGram"]
}
},
"filter": {
"mynGram": {
"type": "nGram",
"min_gram": 2,
"max_gram": 30
}
}
}
},
"mappings": {
"company_info": {
"properties": {
"company" : {"type" : "string"},
"description": {"type": "string"},
"founded": {"type": "string"},
"headquartes": {"type": "string"},
"industry": {"type": "string"},
"numberOfEmployees": {"type": "string"},
"size": {"type": "string"},
"specialties": {"type": "string"},
"typ": {"type" : "string"},
"website": {"type" : "string"},
"domain" : {"type": "string"},
"link": {"type" : "string"},
"linkedinId": {"type": "string"},
"linkedinUrl": {"type": "string"},
"title": {"type": "string"},
"people":{"properties":{"email":{"type":"string"},"id":{"type":"string"},"linkedinId":{"type":"string"},"linkedinUrl":{"type":"string"},"name":{"type":"string"},"title":{"type":"string"},"twitter":{"type":"string"},"verifiedEmail":{"type":"string"}}}
}
}
}
}
答案 0 :(得分:1)
上面的JSON包含settings
和mappings
,您正在点击_mapping
端点。如果您的alpha
索引已存在并且您想要更新其映射,则可以使用以下内容运行以下命令:
curl -XPUT localhost:9200/alpha/_mapping/gremlin --data-binary @company_info_mapping.json
company_info_mapping.json
:
{
"properties": {
"company" : {"type" : "string"},
"description": {"type": "string"},
"founded": {"type": "string"},
"headquartes": {"type": "string"},
"industry": {"type": "string"},
"numberOfEmployees": {"type": "string"},
"size": {"type": "string"},
"specialties": {"type": "string"},
"typ": {"type" : "string"},
"website": {"type" : "string"},
"domain" : {"type": "string"},
"link": {"type" : "string"},
"linkedinId": {"type": "string"},
"linkedinUrl": {"type": "string"},
"title": {"type": "string"},
"people":{"properties":{"email":{"type":"string"},"id":{"type":"string"},"linkedinId":{"type":"string"},"linkedinUrl":{"type":"string"},"name":{"type":"string"},"title":{"type":"string"},"twitter":{"type":"string"},"verifiedEmail":{"type":"string"}}}
}
}
如果要更新现有索引的设置,请使用以下命令点击_settings
端点:
curl -XPUT localhost:9200/alpha/_settings --data-binary @index_settings.json
index_settings.json
:
{
"index.mapping.ignore_malformed": true,
"analysis" : {
"index_analyzer": {
"my_index_analyzer" : {
"type": "custom",
"tokenizer" : "standard",
"filter" : ["lowercase", "mynGram"]
}
},
"search_analyzer": {
"my_search_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter" : ["standard", "lowercase", "mynGram"]
}
},
"filter": {
"mynGram": {
"type": "nGram",
"min_gram": 2,
"max_gram": 30
}
}
}
}