Hunspell dictionaries

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..

is there any way to do this ???

Based on your description, it sounds like you are having trouble matching documents in your "main" index, which is unrelated to hunspell. You should first ensure your documents are structured as you expect. Try adding a single document, then doing your search on the heading field and making sure you find the doc.

Once you get that working, you should consider using the reindex api, which is specifically designed to allow searching on one index and indexing the results into another index.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.