Skip to content

Instantly share code, notes, and snippets.

@filbertkm
Last active January 20, 2016 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filbertkm/5e599567371cfa324bbb to your computer and use it in GitHub Desktop.
Save filbertkm/5e599567371cfa324bbb to your computer and use it in GitHub Desktop.
{
"description": "full_text search for 'life'",
"path": "wikidatawiki_content\/page\/_search",
"params": {
"timeout": "20s"
},
"query": {
"_source": [
"id",
"title",
"namespace",
"redirect.*",
"timestamp",
"text_bytes"
],
"fields": "text.word_count",
"query": {
"bool": {
"minimum_number_should_match": 1,
"should": [
{
"query_string": {
"query": "life",
"fields": [
"all.plain^1",
"all^0.5"
],
"auto_generate_phrase_queries": true,
"phrase_slop": 0,
"default_operator": "AND",
"allow_leading_wildcard": true,
"fuzzy_prefix_length": 2,
"rewrite": "top_terms_boost_1024"
}
},
{
"multi_match": {
"fields": [
"all_near_match^2"
],
"query": "life"
}
}
]
}
},
"highlight": {
"pre_tags": [
"<span class=\"searchmatch\">"
],
"post_tags": [
"<\/span>"
],
"fields": {
"title": {
"number_of_fragments": 0,
"type": "fvh",
"order": "score",
"matched_fields": [
"title",
"title.plain"
]
},
"redirect.title": {
"number_of_fragments": 1,
"fragment_size": 10000,
"type": "fvh",
"order": "score",
"options": {
"skip_if_last_matched": true
},
"matched_fields": [
"redirect.title",
"redirect.title.plain"
]
},
"category": {
"number_of_fragments": 1,
"fragment_size": 10000,
"type": "fvh",
"order": "score",
"options": {
"skip_if_last_matched": true
},
"matched_fields": [
"category",
"category.plain"
]
},
"heading": {
"number_of_fragments": 1,
"fragment_size": 10000,
"type": "fvh",
"order": "score",
"options": {
"skip_if_last_matched": true
},
"matched_fields": [
"heading",
"heading.plain"
]
},
"text": {
"number_of_fragments": 1,
"fragment_size": 150,
"type": "fvh",
"order": "score",
"no_match_size": 150,
"matched_fields": [
"text",
"text.plain"
]
},
"auxiliary_text": {
"number_of_fragments": 1,
"fragment_size": 150,
"type": "fvh",
"order": "score",
"options": {
"skip_if_last_matched": true
},
"matched_fields": [
"auxiliary_text",
"auxiliary_text.plain"
]
}
},
"highlight_query": {
"query_string": {
"query": "life",
"fields": [
"title.plain^20",
"redirect.title.plain^15",
"category.plain^8",
"heading.plain^5",
"opening_text.plain^3",
"text.plain^1",
"auxiliary_text.plain^0.5",
"title^10",
"redirect.title^7.5",
"category^4",
"heading^2.5",
"opening_text^1.5",
"text^0.5",
"auxiliary_text^0.25"
],
"auto_generate_phrase_queries": true,
"phrase_slop": 1,
"default_operator": "AND",
"allow_leading_wildcard": true,
"fuzzy_prefix_length": 2,
"rewrite": "top_terms_boost_1024"
}
}
},
"suggest": {
"text": "life",
"suggest": {
"phrase": {
"field": "suggest",
"size": 1,
"max_errors": 2,
"confidence": 2,
"real_word_error_likelihood": 0.95,
"direct_generator": [
{
"field": "suggest",
"suggest_mode": "always",
"max_term_freq": 0.5,
"min_doc_freq": 0,
"prefix_length": 2
}
],
"highlight": {
"pre_tag": "<em>",
"post_tag": "<\/em>"
},
"smoothing": {
"stupid_backoff": {
"discount": 0.4
}
}
}
}
},
"stats": [
"suggest",
"full_text"
],
"size": 20,
"rescore": [
{
"window_size": 8192,
"query": {
"rescore_query_weight": 0.8,
"rescore_query": {
"function_score": {
"score_mode": "sum",
"functions": [
{
"field_value_factor": {
"field": "sitelink_count",
"missing": 0
},
"weight": 1
},
{
"field_value_factor": {
"field": "label_count",
"missing": 0
},
"weight": 1
},
{
"field_value_factor": {
"field": "statement_count",
"missing": 0
},
"weight": 1
}
]
}
}
}
}
]
},
"options": {
"timeout": "20s"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment