我正在尝试创建一个分析器,用空格替换特殊字符并将其转换为大写。然后,如果我想用小写搜索它也应该工作。
Mapping Analyzer:
s from the join table where:
First subquery:
where there is not another join table row for that same category
with an
通过用空格替换特殊字符来正确地标记单词。现在如果我从文本中搜索一个单词,它就不会检索到任何结果。
that is *not* in the set of
我没有从上面的GET查询中得到任何结果。得到如下结果:
s
for the category you are matching against, and
Second subquery:
where there is not an item in the category you are matching against
that is not also in the category you are selecting (ci table)
任何人都可以帮助我!谢谢!
答案 0 :(得分:1)
创建索引后,您似乎没有索引任何数据。对_analyze
的调用不会对任何内容编制索引,只是简单地向您展示如何分析您发送给ES的内容。
首先,您需要通过指定使用您定义的分析器的映射来创建索引:
curl -XPUT 'http://localhost:9200/aida' -d '{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"char_filter": [
"my_char_filter"
],
"filter": [
"uppercase"
]
}
},
"char_filter": {
"my_char_filter": {
"type": "pattern_replace",
"pattern": "(\\d+)-(?=\\d)",
"replacement": "$1 "
}
}
}
},
"mappings": { <--- add a mapping type...
"doc": {
"properties": {
"text": { <--- ...with a field...
"type": "string",
"analyzer": "my_analyzer" <--- ...using your analyzer
}
}
}
}
}'
然后你可以索引一个新的真实文档:
curl -XPOST 'http://localhost:9200/aida/doc' -d '{
"text": "My name is Soun*arya?jwnne&yuuk"
}'
最后,您可以搜索:
curl -XGET 'http://localhost:9200/aida/_search' -d '{
"query":{
"match":{
"text":"My"
}
}
}'