Affecting relevance scoring with proximity
A simple match
query within a bool
query
GET /proximity/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"title": {
"query": "spicy sauce"
}
}
}
]
}
}
}
Boosting relevance based on proximity
GET /proximity/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"title": {
"query": "spicy sauce"
}
}
}
],
"should": [
{
"match_phrase": {
"title": {
"query": "spicy sauce"
}
}
}
]
}
}
}
Adding the slop
parameter
GET /proximity/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"title": {
"query": "spicy sauce"
}
}
}
],
"should": [
{
"match_phrase": {
"title": {
"query": "spicy sauce",
"slop": 5
}
}
}
]
}
}
}