【发布时间】:2016-11-04 17:24:25
【问题描述】:
我使用名为“自动完成”的定制分析器创建了一个索引“用户名”:
client.indices.create({
index: 'user-name',
type: 'text',
settings: {
analysis: {
filter: {
autocomplete_filter: {
type: 'edge-ngram',
min_gram: 1,
max_gram: 20
}
},
analyzer: {
autocomplete: {
type: 'custom',
tokenizer: 'standard',
filter: [
'lowercase',
'autocomplete_filter'
]
}
}
}
}
}
然后我尝试通过在映射中使用这个定制分析器来引用它:
client.indices.putMapping({
index: 'user-name',
type: 'text',
body: {
properties: {
name: {
type: 'string',
analyzer: 'autocomplete',
search_analyzer: 'standard'
}
}
}
})
但随后我收到此错误:“原因”:“未找到字段 [名称] 的分析器 [自动完成]”。为什么没有检测到我的自动完成分析器?谢谢。
【问题讨论】:
标签: node.js elasticsearch indexing full-text-search analyzer