Reputation: 301
I am trying to disable TF/IDF using constant_score for a multi_match query.
GET cities/_search
{
"query": {
"bool": {
"must": [
{
"constant_score": {
"query": {
"multi_match": {
"query": "new york",
"fields": [
"city",
"village"
]
}
}
}
}
]
}
}
}
but i got the following error:
"reason": "[constant_score] query does not support [query]".
I also tried without using the query wrapper
GET cities/_search
{
"query": {
"bool": {
"must": [
{
"constant_score": {
"multi_match": {
"query": "new york",
"fields": [
"city",
"village"
]
}
}
}
]
}
}
}
But i got the following error :
"[constant_score] query does not support [multi_match]".
Is there a workaround to use them together?
Upvotes: 1
Views: 1305
Reputation: 15579
I am no expert in elasticsearch, but reading this documentation
constant_score
queryA query which wraps another query, but executes it in filter context. All matching documents are given the same “constant” _score.
I believe you need something like this:
GET cities/_search
{
"query": {
"constant_score": {
"filter": {
"multi_match": {
"query": "new york",
"fields": [
"city",
"village"
]
}
}
}
}
}
Upvotes: 1