Created
October 30, 2017 16:58
-
-
Save tlovett1/db20f16bde0c6bf59f2e3e18721e9b34 to your computer and use it in GitHub Desktop.
Example post type boost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"from": 0, | |
"size": 10, | |
"sort": [ | |
{ | |
"_score": { | |
"order": "desc" | |
} | |
} | |
], | |
"query": { | |
"function_score": { | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"bool": { | |
"should": [ | |
{ | |
"multi_match": { | |
"query": "test", | |
"type": "phrase", | |
"fields": [ | |
"post_title^10", | |
"post_content^1", | |
"post_excerpt^1", | |
"terms.post_tag.name^1", | |
"terms.category.name^1", | |
"post_author.login^1" | |
], | |
"boost": 4 | |
} | |
}, | |
{ | |
"multi_match": { | |
"query": "test", | |
"fields": [ | |
"post_title^10", | |
"post_content^1", | |
"post_excerpt^1", | |
"terms.post_tag.name^1", | |
"terms.category.name^1", | |
"post_author.login^1" | |
], | |
"boost": 2, | |
"fuzziness": 0, | |
"operator": "and" | |
} | |
}, | |
{ | |
"multi_match": { | |
"fields": [ | |
"post_title^10", | |
"post_content^1", | |
"post_excerpt^1", | |
"terms.post_tag.name^1", | |
"terms.category.name^1", | |
"post_author.login^1" | |
], | |
"query": "test", | |
"fuzziness": 1 | |
} | |
} | |
] | |
} | |
} | |
], | |
"should": [ | |
{ | |
"match": { | |
"post_type": { | |
"query": "page", | |
"boost": 10 | |
} | |
} | |
} | |
] | |
} | |
}, | |
"exp": { | |
"post_date_gmt": { | |
"scale": "14d", | |
"decay": 0.25, | |
"offset": "7d" | |
} | |
}, | |
"score_mode": "avg", | |
"boost_mode": "sum", | |
"boost": 1 | |
} | |
}, | |
"post_filter": { | |
"bool": { | |
"must": [ | |
{ | |
"terms": { | |
"post_type.raw": [ | |
"post", | |
"page" | |
] | |
} | |
}, | |
{ | |
"terms": { | |
"post_status": [ | |
"publish", | |
"acf-disabled" | |
] | |
} | |
} | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment