我正在使用Elasticsearch来提供我们网站的搜索功能。
我一直在尝试它,但我无法启用porterstem分析器(因此搜索战斗与战斗和战斗相匹配)。
这是我的输入结果。
curl -XPUT localhost:9200/local/ -d'
index :
analysis :
analyzer :
stemming :
type : custom
tokenizer : standard
filter : [standard, lowercase, stop, porterStem]
'
curl -XPUT localhost:9200/local/_mapping -d'{"properties": { "title" : { "analyzer" : "stemming", "type" : "string" }}}'
curl -XPUT localhost:9200/local/article/1 -d'{"title": "Fight for your life"}'
curl -XPUT localhost:9200/local/article/2 -d'{"title": "Fighting for your life"}'
curl -XPUT localhost:9200/local/article/3 -d'{"title": "My dad fought a dog"}'
curl -XPUT localhost:9200/local/article/4 -d'{"title": "Bruno fights Tyson tomorrow"}'
然而,搜索'fight'只会匹配第一个条目 - 包含确切术语的条目。
curl -XGET localhost:9200/local/_search?q=fight
似乎已设置了正确的设置,但似乎无效。
"indices" : {
"local" : {
"aliases" : [ ],
"settings" : {
"index.analysis.analyzer.stemming.type" : "custom",
"index.analysis.analyzer.stemming.tokenizer" : "standard",
"index.analysis.analyzer.stemming.filter.1" : "lowercase",
"index.analysis.analyzer.stemming.filter.0" : "standard",
"index.analysis.analyzer.stemming.filter.3" : "porterStem",
"index.analysis.analyzer.stemming.filter.2" : "stop",
"index.number_of_shards" : "5",
"index.number_of_replicas" : "1"
},
任何人都可以启动并运行此功能并能够指出我正确的方向吗?