Skip to content

Instantly share code, notes, and snippets.

@tlovett1
Created May 22, 2017 03:18
Show Gist options
  • Save tlovett1/b737f1f2205827cf005673aa700dcd94 to your computer and use it in GitHub Desktop.
Save tlovett1/b737f1f2205827cf005673aa700dcd94 to your computer and use it in GitHub Desktop.
{
"from": 0,
"size": 10,
"sort": [
{
"_score": {
"order": "desc"
}
}
],
"query": {
"function_score": {
"query": {
"bool": {
"should": [
{
"multi_match": {
"query": "trump",
"type": "phrase",
"fields": [
"post_title",
"post_content",
"post_excerpt",
"author_name",
"terms.post_tag.name",
"terms.category.name",
"post_author.login"
],
"boost": 4
}
},
{
"multi_match": {
"query": "trump",
"fields": [
"post_title",
"post_content",
"post_excerpt",
"author_name",
"terms.post_tag.name",
"terms.category.name",
"post_author.login"
],
"boost": 3,
"fuzziness": 0,
"operator": "and"
}
},
{
"multi_match": {
"fields": [
"post_title",
"post_content",
"post_excerpt",
"author_name",
"terms.post_tag.name",
"terms.category.name",
"post_author.login"
],
"query": "trump",
"fuzziness": 1
}
}
]
}
},
"exp": {
"post_date_gmt": {
"scale": "28d",
"decay": 0.25,
"offset": "7d"
}
}
}
},
"post_filter": {
"bool": {
"must": [
{
"terms": {
"post_type.raw": [
"post",
"page",
"attachment",
"soliloquy",
"storybank",
"perspectives",
"events",
"testimonial"
]
}
},
{
"term": {
"post_status": "publish"
}
}
]
}
},
"aggs": {
"terms": {
"filter": {
"bool": {
"must": [
{
"terms": {
"post_type.raw": [
"post",
"page",
"attachment",
"soliloquy",
"storybank",
"perspectives",
"events",
"testimonial"
]
}
},
{
"term": {
"post_status": "publish"
}
}
]
}
},
"aggs": {
"category": {
"terms": {
"size": 200,
"field": "terms.category.slug"
}
},
"post_tag": {
"terms": {
"size": 200,
"field": "terms.post_tag.slug"
}
},
"region": {
"terms": {
"size": 200,
"field": "terms.region.slug"
}
},
"ethnicity": {
"terms": {
"size": 200,
"field": "terms.ethnicity.slug"
}
},
"profession": {
"terms": {
"size": 200,
"field": "terms.profession.slug"
}
}
}
}
}
}
{
"from": 0,
"size": 10,
"sort": [
{
"_score": {
"order": "desc"
}
}
],
"query": {
"function_score": {
"query": {
"bool": {
"should": [
{
"multi_match": {
"query": "trump",
"type": "phrase",
"fields": [
"post_title",
"post_content",
"post_excerpt",
"author_name",
"terms.post_tag.name",
"terms.category.name",
"post_author.login"
],
"boost": 4
}
},
{
"multi_match": {
"query": "trump",
"fields": [
"post_title",
"post_content",
"post_excerpt",
"author_name",
"terms.post_tag.name",
"terms.category.name",
"post_author.login"
],
"boost": 3,
"fuzziness": 0,
"operator": "and"
}
},
{
"multi_match": {
"fields": [
"post_title",
"post_content",
"post_excerpt",
"author_name",
"terms.post_tag.name",
"terms.category.name",
"post_author.login"
],
"query": "trump",
"fuzziness": 1
}
}
]
}
},
"exp": {
"post_date_gmt": {
"scale": "28d",
"decay": 0.25,
"offset": "7d"
}
}
}
},
"post_filter": {
"bool": {
"must": [
{
"terms": {
"post_type.raw": [
"post",
"page",
"attachment",
"soliloquy",
"storybank",
"perspectives",
"events",
"testimonial"
]
}
},
{
"terms": {
"post_status": [
"publish",
"acf-disabled"
]
}
}
]
}
},
"aggs": {
"terms": {
"filter": {
"bool": {
"must": [
{
"terms": {
"post_type.raw": [
"post",
"page",
"attachment",
"soliloquy",
"storybank",
"perspectives",
"events",
"testimonial"
]
}
},
{
"terms": {
"post_status": [
"publish",
"acf-disabled"
]
}
}
]
}
},
"aggs": {
"category": {
"terms": {
"size": 200,
"field": "terms.category.slug"
}
},
"post_tag": {
"terms": {
"size": 200,
"field": "terms.post_tag.slug"
}
},
"region": {
"terms": {
"size": 200,
"field": "terms.region.slug"
}
},
"ethnicity": {
"terms": {
"size": 200,
"field": "terms.ethnicity.slug"
}
},
"profession": {
"terms": {
"size": 200,
"field": "terms.profession.slug"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment