Created
November 13, 2017 19:13
-
-
Save smalyshev/a05e55c39c9f7bd9c9b3c39ce04cd1a8 to your computer and use it in GitHub Desktop.
This file contains 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
{ | |
"description": "entity_full_text search for 'something'", | |
"path": "wikidatawiki_content\/page\/_search", | |
"params": { | |
"timeout": "20s", | |
"search_type": "dfs_query_then_fetch" | |
}, | |
"query": { | |
"_source": [ | |
"namespace", | |
"title", | |
"namespace_text", | |
"wiki", | |
"sitelink_count", | |
"statement_count", | |
"labels.en", | |
"descriptions.en" | |
], | |
"stored_fields": [], | |
"query": { | |
"bool": { | |
"disable_coord": true, | |
"should": [ | |
{ | |
"bool": { | |
"filter": [ | |
{ | |
"bool": { | |
"should": [ | |
{ | |
"match": { | |
"all": { | |
"query": "something", | |
"operator": "AND" | |
} | |
} | |
}, | |
{ | |
"match": { | |
"all.plain": { | |
"query": "something", | |
"operator": "AND" | |
} | |
} | |
} | |
] | |
} | |
} | |
], | |
"should": [ | |
{ | |
"dis_max": { | |
"tie_breaker": 0, | |
"queries": [ | |
{ | |
"constant_score": { | |
"filter": { | |
"match": { | |
"labels.en.near_match": "something" | |
} | |
}, | |
"boost": 2 | |
} | |
}, | |
{ | |
"constant_score": { | |
"filter": { | |
"match": { | |
"labels.en.near_match_folded": "something" | |
} | |
}, | |
"boost": 1.8 | |
} | |
} | |
] | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"bool": { | |
"should": [ | |
{ | |
"constant_score": { | |
"filter": { | |
"match": { | |
"all": "something" | |
} | |
}, | |
"boost": 0.001 | |
} | |
}, | |
{ | |
"constant_score": { | |
"filter": { | |
"match": { | |
"all.plain": "something" | |
} | |
}, | |
"boost": 0.001 | |
} | |
}, | |
{ | |
"dis_max": { | |
"tie_breaker": 1, | |
"queries": [ | |
{ | |
"constant_score": { | |
"filter": { | |
"match": { | |
"descriptions.en": "something" | |
} | |
}, | |
"boost": 1.8 | |
} | |
}, | |
{ | |
"constant_score": { | |
"filter": { | |
"match": { | |
"labels.en.plain": "something" | |
} | |
}, | |
"boost": 1.8 | |
} | |
}, | |
{ | |
"constant_score": { | |
"filter": { | |
"match": { | |
"descriptions.en.plain": "something" | |
} | |
}, | |
"boost": 0.001 | |
} | |
} | |
] | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"term": { | |
"title.keyword": "something" | |
} | |
} | |
], | |
"minimum_should_match": 1, | |
"filter": [ | |
{ | |
"terms": { | |
"namespace": [ | |
0 | |
] | |
} | |
} | |
] | |
} | |
}, | |
"highlight": { | |
"pre_tags": [ | |
"\ue000" | |
], | |
"post_tags": [ | |
"\ue001" | |
], | |
"fields": { | |
"title": { | |
"type": "experimental", | |
"fragmenter": "none", | |
"number_of_fragments": 0, | |
"matched_fields": [ | |
"title.keyword" | |
] | |
}, | |
"labels.en.plain": { | |
"type": "experimental", | |
"fragmenter": "none", | |
"number_of_fragments": 0, | |
"options": { | |
"skip_if_last_matched": true | |
} | |
}, | |
"descriptions.en.plain": { | |
"type": "experimental", | |
"fragmenter": "none", | |
"number_of_fragments": 0, | |
"options": { | |
"skip_if_last_matched": true | |
} | |
}, | |
"labels.*.plain": { | |
"type": "experimental", | |
"fragmenter": "none", | |
"number_of_fragments": 0, | |
"options": { | |
"skip_if_last_matched": true | |
} | |
}, | |
"descriptions.*.plain": { | |
"type": "experimental", | |
"fragmenter": "none", | |
"number_of_fragments": 0, | |
"options": { | |
"skip_if_last_matched": true | |
} | |
} | |
} | |
}, | |
"size": 20, | |
"stats": [ | |
"entity_full_text" | |
], | |
"rescore": [ | |
{ | |
"window_size": 8192, | |
"query": { | |
"query_weight": 1, | |
"rescore_query_weight": 1, | |
"score_mode": "total", | |
"rescore_query": { | |
"function_score": { | |
"score_mode": "sum", | |
"functions": [ | |
{ | |
"script_score": { | |
"script": { | |
"inline": "pow(doc['incoming_links'].value , 2) \/ ( pow(doc['incoming_links'].value, 2) + pow(50,2))", | |
"lang": "expression" | |
} | |
}, | |
"weight": 0.6 | |
}, | |
{ | |
"script_score": { | |
"script": { | |
"inline": "pow(doc['sitelink_count'].value , 2) \/ ( pow(doc['sitelink_count'].value, 2) + pow(20,2))", | |
"lang": "expression" | |
} | |
}, | |
"weight": 0.4 | |
} | |
] | |
} | |
} | |
} | |
} | |
] | |
}, | |
"options": { | |
"timeout": "20s", | |
"search_type": "dfs_query_then_fetch" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment