I want to boost a query if its by match phrasing but I want it to search only in a certain field. So far I have the following query
{
"query": {
"bool": {
"should": [
{
"match_phrase": {
"_all": {
"query": "string",
"boost": 5
}
}
}
]
}
}
}
but this returns several results since I'm not specifying the field where it should search in. I tried this other approach:
{
"query": {
"bool": {
"should": [
{
"match_phrase": {
"_all": {
"query": "string",
"fields": [
"filed_name"
],
"boost": 5
}
}
}
]
}
}
}
but I get the error
[match] query does not support [fields]]
You can use multi match query and use
phrase type
to domatch_phrase
in specific fields.