I have implemented a news search engine on elastic search. I have indexed
the articles and run the search query as following. When I search for "A B
C", I want the search engine to give more weightage to exact matches of "A
B C" > "A B" / "B C" > "A" / "B" / "C". Its not happening. How can I change
the search query to reflect this?
es.indices.create(
index="article-index",
body={
'settings': {
'analysis': {
'analyzer': {
'my_ngram_analyzer' : {
'tokenizer' : 'my_ngram_tokenizer'
}
},
'tokenizer' : {
'my_ngram_tokenizer' : {
'type' : 'nGram',
'min_gram' : '1',
'max_gram' : '50'
}
}
}
}
},
# ignore already existing index
ignore=400
)
res = es.search(index="article-index", fields="url", body={"query": {"query_string": {"query": keywordstr}})
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8fc93f16-b207-4fa5-ba17-644e7ad12c9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.