Reputation: 7074
There is a business requirement to have an exact match on the entity_type field and then a partial match on the predicates.name.value field with the results sorted for exact matches first.
Below is what I have for the query for the exact match for both. How would I change it so that it is a partial match for the predicates.name.value field with the exact matches sorted first?
self.search = {
"query" : {
"bool" : {
"must" : [
{
"match" : {
"entity_type" : entity_type
}
},
{
"match" : {
"predicates.name.value" : criteria
}
},
]
}
}
}
Upvotes: 0
Views: 149
Reputation: 21406
Can you try this;
self.search = {
"query" : {
"bool" : {
"must" : [
{
"match" : {
"entity_type" : entity_type
}
},
{"query": {"wildcard": {"predicates.name.value": {"value": "*criteria*"}}}},
]
}
}
}
Upvotes: 1