I am trying to write a search engine where I want to get the result only, if say -> chess, player, game words are there I would return result only if all these 3 words present twice or thrice in any of the field ["description","keywords","summary"] in particular index, but its getting me result by single words in single field. Can anyone help me out in this ?
search_term = chess player game
search_result = Elasticsearch::Persistence.client.search \
index: AlphaES.index_name ,
type: 'alpha_es',
body: {
from: 0,
size:1000,
query: {
bool: {
filter: [
{
"term": {
"entity_type": { "value": entity_type }
}
},
{
"term": {
"active_flag": { "value": 1 }
}
}
],
should: [
{
"multi_match":{
"query": "#{search_term}",
"fields": ["description","keywords","summary"]
# "operator": "and"
# "boost":5
}
},
{
match: {
description: {
query: "#{search_term}",
operator: 'and'
# fuzziness: 'AUTO'
}
}
},
{
match: {
keywords: {
query: "#{search_term}",
operator: 'and'
# fuzziness: 'AUTO'
}
}
},
{
match: {
summary: {
query: "#{search_term}",
operator: 'and'
# fuzziness: 'AUTO'
}
}
}
]
}
}
}