Unable to generate word sequence


(kanchan) #1

Hi Team,
I have create a query for searching data.

GET /coalition_assets_casematch/_search
{
"query": {
"multi_match" : {
"query": "media trader",
"type": "best_fields",
"fields": [ "coalition_name" ],
"operator": "and"
}
},
"size" : 10
}

but in records I am not getting words in order like I am searching records which have media trader but if I have coalition_name: 'media trader' that records also coming.
how can I maintain words order while searching.


(Peter Pisljar) #2

the order of query terms does not have an effect to the order of results

if you are trying to match exact query try to use: match query phrase: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html


(kanchan) #3

but match phrase will take care of all words.I want if any one word also present that records also show and if 2 words match that also should show but that two words should follow the sequence.using match_phrase it will give only if match all words.


(system) #4

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