Skip to content

Instantly share code, notes, and snippets.

@nicmart
Created June 9, 2026 08:10
Show Gist options
  • Select an option

  • Save nicmart/f18a7d9f61d104a9db0f68cb946ae8db to your computer and use it in GitHub Desktop.

Select an option

Save nicmart/f18a7d9f61d104a9db0f68cb946ae8db to your computer and use it in GitHub Desktop.
eyquery.json
{
"from": 0, "size": 20, "track_total_hits": true,
"query": { "bool": {
"must": [ { "bool": {
"should": [
{ "constant_score": { "boost": 100, "filter": { "multi_match": {
"query": "trifase", "type": "best_fields", "tie_breaker": 0.2,
"operator": "and", "analyzer": "ey_italian",
"fields": ["searchable_title_strong", "searchable_title"]
} } } }, /* EXACT */
{ "constant_score": { "boost": 100, "filter": { "multi_match": {
"query": "trifase", "type": "bool_prefix",
"fields": ["searchable_title_strong.sayt","searchable_title_strong.sayt._2gram","searchable_title_strong.sayt._3gram",
"searchable_title.sayt","searchable_title.sayt._2gram","searchable_title.sayt._3gram",
"searchable_title_weak.sayt","searchable_title_weak.sayt._2gram","searchable_title_weak.sayt._3gram"]
} } } }, /* PREFIX */
{ "constant_score": { "boost": 1, "filter": { "bool": {
"must": [ { "multi_match": {
"query": "trifase", "type": "best_fields", "tie_breaker": 0.2,
"operator": "and", "fuzziness": "AUTO:4,7", "prefix_length": 1,
"fields": ["searchable_title_strong^16","searchable_title^4","searchable_body^2","searchable_title_weak^1"]
} } ],
"must_not": [ { "term": { "type": "user" } } ]
} } } } /* TYPO (only tier with body) */
],
"minimum_should_match": 1
} } ],
"filter": [
{ "bool": { "filter": [ { "term": { "published": true } } ] } } /* viewer/visibility */
],
"should": [
{ "constant_score": { "boost": 5, "filter": { "term": { "type": "article" } } } },
{ "constant_score": { "boost": 10, "filter": { "term": { "type": "user" } } } },
{ "rank_feature": { "field": "features.popularity", "saturation": { "pivot": 3500 }, "boost": 10 } },
{ "rank_feature": { "field": "features.votes", "saturation": { "pivot": 8 }, "boost": 4 } },
{ "constant_score": { "boost": 25, "filter": { "multi_match": {
"query": "trifase", "type": "phrase", "analyzer": "ey_italian",
"fields": ["searchable_title_strong", "searchable_title"]
} } } } /* phrase-proximity (title) */
]
} },
"sort": [ "_score", { "created_at": { "order": "desc", "unmapped_type": "long" } } ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment