我使用PUT http://localhost:9200/test:
创建这样的索引{
"settings": {
"number_of_shards": 1,
"analysis": {
"analyzer": {
"sortable": {
"type": "custom",
"tokenizer": "keyword",
"filter": [
"lowercase"
]
}
}
}
},
"mappings": {
}
}
这返回:
{"acknowledged":true}
然后确保分析仪在那里: http://localhost:9200/test/_analyze?_analyzer=sortable&text=HeLLo
{"tokens":[{"token":"hello","start_offset":0,"end_offset":5,"type":"<ALPHANUM>","position":0}]}
所以我为它创建了映射: 通过PUT http://localhost:9200/test/_mapping/company
{
"properties": {
"name": {
"type": "string",
"analyzer": "standard",
"fields": {
"raw": {
"type": {
"analyzer": "sortable"
}
}
}
}
}
返回:
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"no handler for type [{analyzer=sortable}] declared on field [raw]"}],"type":"mapper_parsing_exception","reason":"no handler for type [{analyzer=sortable}] declared on field [raw]"},"status":400}
有什么问题?
答案 0 :(得分:1)
您的company
映射需要修复此问题:
{
"properties": {
"name": {
"type": "string",
"analyzer": "standard",
"fields": {
"raw": {
"type": "string",
"analyzer": "sortable"
}
}
}
}