You could use a bool query that combines a query for the entire phrase (using the match_phrase query), combined with a query for the individual terms (using a match query). The idea is that documents that contain the exact phrase will get a higher score, because they will match on both clauses.
The query cwould look something like this:
GET _search
{
"query": {
"bool": {
"must": {
"match": {
"content": "My custom phrase"
}
},
"should": {
"match_phrase": {
"content": "My custom phrase"
}
}
}
}
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.