i'm having an index 'main' where i'm having headings of a site.
my requirement is to search this index with some keywords/phrases .
Then to create a new index 'result' with the matches.
i'm using 'Hunspell'
i need
computer => computers
computers =>computer
drink=>drank/drunk
drunk=>drank/drink
drank=> drink/drunk
jump=>jumping
jumping=>jump
so,after the configuration of Hunspell i gave a word "print" to be searched inside main index which have "printed" in heading ,but it didn't produce any hits .
Hunspell setting ..
client.indices.putSettings({
index: 'result',
body: { "analysis" : {
"analyzer" : {
"en" : {
"tokenizer" :"lowercase",
"filter" : [ "lowercase", "en_US" ]
}
},
"filter" : {
"en_US" : {
"type" : "hunspell",
"locale" : "en_US",
"dedup" : true
}
}
}}
});
the same setting is given for the main index creation as well
client.search({
"index": 'main',
"type": 'index',
"body": {
"query": {
"bool": {
"should": [
{"match": {"heading": "print"}}
]
}
}},
},function (error, response,status) {
if (error){
console.log(error);
}
else {
response.hits.hits.forEach(function(hit){
// console.log();
client.bulk({
"body": [
{"index":{
"_index":"result",
"_type":"index",
"_id":" "}},
{"body": hit._source }]}) })
} });
I will be grateful if you can provide some help..