如何创建一个映射来标记空格上的字符串并将其更改为小写以进行索引?
How can I create a mapping that will tokenize the string on whitespace and also change it to lowercase for indexing?
这是我当前的映射,它通过空格进行标记,我无法理解如何将其小写并搜索(查询)相同...
This is my current mapping that tokenizes by whitespace by I cant understand how to lowercase it and also search (query) the same...
{
"mappings": {
"my_type" : {
"properties" : {
"title" : { "type" : "string", "analyzer" : "whitespace", "tokenizer": "whitespace", "search_analyzer":"whitespace" }
}
}
}
}
请帮忙...
我设法编写了一个自定义分析器,并且这个工作......
i managed to write a custom analyzer and this works...
"settings":{
"analysis": {
"analyzer": {
"lowercasespaceanalyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase"
]
}
}
}
},
"mappings": {
"my_type" : {
"properties" : {
"title" : { "type" : "string", "analyzer" : "lowercasespaceanalyzer", "tokenizer": "whitespace", "search_analyzer":"whitespace", "filter": [
"lowercase"
] }
}
}
}
这篇关于elasticsearch 分析器 - 小写和空格标记器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!