{
    "description": "wikibase_prefix search for 'q42'",
    "params": {
        "timeout": "20s"
    },
    "query": {
        "query": {
            "bool": {
                "should": [
                    {
                        "bool": {
                            "filter": [
                                {
                                    "match": {
                                        "labels_all.prefix": "q42"
                                    }
                                }
                            ],
                            "should": [
                                {
                                    "dis_max": {
                                        "tie_breaker": 0,
                                        "queries": [
                                            {
                                                "constant_score": {
                                                    "filter": {
                                                        "match": {
                                                            "labels.en.near_match": "q42"
                                                        }
                                                    },
                                                    "boost": 2
                                                }
                                            },
                                            {
                                                "constant_score": {
                                                    "filter": {
                                                        "match": {
                                                            "labels.en.near_match_folded": "q42"
                                                        }
                                                    },
                                                    "boost": 1.6
                                                }
                                            },
                                            {
                                                "constant_score": {
                                                    "filter": {
                                                        "match": {
                                                            "labels.en.prefix": "q42"
                                                        }
                                                    },
                                                    "boost": 1.1
                                                }
                                            },
                                            {
                                                "constant_score": {
                                                    "filter": {
                                                        "match": {
                                                            "labels_all.near_match_folded": "q42"
                                                        }
                                                    },
                                                    "boost": 0.001
                                                }
                                            }
                                        ]
                                    }
                                }
                            ]
                        }
                    },
                    {
                        "term": {
                            "title.keyword": "Q42"
                        }
                    }
                ],
                "minimum_should_match": 1,
                "filter": [
                    {
                        "term": {
                            "content_model": "wikibase-item"
                        }
                    }
                ]
            }
        },
        "_source": [
            "namespace",
            "title",
            "namespace_text",
            "wiki",
            "labels.en",
            "descriptions.en"
        ],
        "fields": [],
        "highlight": {
            "pre_tags": [
                ""
            ],
            "post_tags": [
                ""
            ],
            "fields": {
                "title": {
                    "type": "experimental",
                    "fragmenter": "none",
                    "number_of_fragments": 0,
                    "matched_fields": [
                        "title.keyword"
                    ]
                },
                "labels.en.prefix": {
                    "type": "experimental",
                    "fragmenter": "none",
                    "order": "none",
                    "number_of_fragments": 0,
                    "options": {
                        "skip_if_last_matched": true,
                        "return_snippets_and_offsets": true
                    }
                },
                "labels.*.prefix": {
                    "type": "experimental",
                    "fragmenter": "none",
                    "order": "none",
                    "number_of_fragments": 0,
                    "options": {
                        "skip_if_last_matched": true,
                        "return_snippets_and_offsets": true
                    }
                }
            }
        },
        "size": 10,
        "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": {
                                            "source": "pow(doc['incoming_links'].value , 1) \/ ( pow(doc['incoming_links'].value, 1) + pow(100,1))",
                                            "lang": "expression"
                                        }
                                    },
                                    "weight": 0.6
                                },
                                {
                                    "script_score": {
                                        "script": {
                                            "source": "pow(doc['sitelink_count'].value , 2) \/ ( pow(doc['sitelink_count'].value, 2) + pow(20,2))",
                                            "lang": "expression"
                                        }
                                    },
                                    "weight": 0.4
                                }
                            ]
                        }
                    }
                }
            }
        ],
        "stats": [
            "wikibase-prefix"
        ]
    },
    "options": {
        "timeout": "20s"
    }
}