Hi ,
I am using elasticsearch v5.4.3 it seems it is not supporting stemming.
</> curl -X PUT "localhost:9200/my_index" -H 'Content-Type: application/json' -d'
{
"settings": {
"analysis" : {
"analyzer" : {
"my_analyzer" : {
"tokenizer" : "standard",
"filter" : ["standard", "lowercase", "my_stemmer"]
}
},
"filter" : {
"my_stemmer" : {
"type" : "stemmer",
"name" : "english"
}
}
}
}
}
'
</>
{"acknowledged":true,"shards_acknowledged":true,"index":"my_index"}[root@node1 ~]#
Now insert data
</> curl -XPUT "localhost:9200/my_index/user/1" -d '{ "text": "Qbox Elasticsearch Hosting is not at all difficult" }'
{"_index":"my_index","_type":"user","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"created":true}[root@node1 ~]# curl -XPUT "localhost:9200/my_index/user/2" -d '{ "name": "Unconventional Elasticsearch Hosting is difficult" }'
{"_index":"my_index","_type":"user","_id":"2","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"created":true}[root@node1 ~]#
</>
====================================
Perform search query
</>
curl -XGET 'localhost:9200/analysis1/user/_search' -d '{
"query": {
"multi_match": {
"type": "most_fields",
"query": "not difficult Qbox host",
"fields": [ "text", "text.english" ]
}
}
}'
</>
Output Received :
{"took":4,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":0.84748024,"hits":[{"_index":"analysis1","_type":"user","_id":"1","_score":0.84748024,"_source":{ "text": "Qbox Elasticsearch Hosting is not at all difficult" }}]}}[root@node1 ~]#
Expected output :
both documents are returned as results due to the word stemming