我似乎无法弄清楚如何获得elasticsearch(通过pyes访问)来搜索复数/单数术语。例如,当我进入Monkies时,我想要得到带有Belt的结果。我看过Elasticsearch not returning singular/plural matches,但似乎无法理解它。下面是一些卷曲陈述Elasticsearch搜索复数
curl -XDELETE localhost:9200/myindex
curl -XPOST localhost:9200/myindex -d '
{"index":
{ "number_of_shards": 1,
"analysis": {
"filter": {
"myfilter": {
"type" : "porter_stem",
"language" : "English"
}
},
"analyzer": {
"default" : {
"tokenizer" : "nGram",
"filter" : ["lowercase", "myfilter"]
},
"index_analyzer" : {
"tokenizer" : "nGram",
"filter" : ["lowercase", "myfilter"]
},
"search_analyzer" : {
"tokenizer" : "nGram",
"filter" : ["lowercase", "myfilter"]
}
}
}
}
}
}'
curl -XPUT localhost:9200/myindex/mytype/_mapping -d '{
"tweet" : {
"date_formats" : ["yyyy-MM-dd", "dd-MM-yyyy"],
"properties" : {
"user": {"type":"string"},
"post_date": {"type": "date"},
"message" : {"type" : "string", "analyzer": "search_analyzer"}
}
}}'
curl -XPUT 'http://localhost:9200/myindex/mytype/1' -d '{
"user" : "kimchy",
"post_date" : "2009-11-15T14:12:12",
"message" : "belt knife is a cool thing"
}'
curl -XPUT 'http://localhost:9200/myindex/mytype/2' -d '{
"user" : "alwild",
"post_date" : "2009-11-15T14:12:12",
"message" : "second message with nothing else"
}'
curl -XGET localhost:9200/myindex/mytype/_search?q=message:belts
我它得到的地步,寻找皮带给我一些结果...但现在它给了过多的结果。我必须做些什么来让它只返回那个有“带”的条目呢?
我编辑的问题,包括卷曲的供词,以及改变了一点东西。它现在正在返回多个结果,但它返回了太多/不相关的结果。谢谢你的帮助。 – 2013-03-01 06:48:35