{
    "bool": {
        "must": [
            {
                "bool": {
                    "should": [
                        {
                            "multi_match": {
                                "query": "cat AND dog NOT donkey",
                                "fields": [
                                    "all_near_match^5",
                                    "all_near_match.asciifolding^3.75"
                                ]
                            }
                        },
                        {
                            "bool": {
                                "must": [
                                    {
                                        "function_score": {
                                            "query": {
                                                "bool": {
                                                    "minimum_should_match": 1,
                                                    "should": [
                                                        {
                                                            "dis_max": {
                                                                "tie_breaker": 1,
                                                                "queries": [
                                                                    {
                                                                        "bool": {
                                                                            "minimum_should_match": 0,
                                                                            "filter": [
                                                                                {
                                                                                    "multi_match": {
                                                                                        "query": "cat",
                                                                                        "fields": [
                                                                                            "all",
                                                                                            "all.plain"
                                                                                        ],
                                                                                        "operator": "and"
                                                                                    }
                                                                                }
                                                                            ],
                                                                            "should": [
                                                                                {
                                                                                    "match": {
                                                                                        "title": {
                                                                                            "query": "cat",
                                                                                            "boost": 0.45
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "title.plain": {
                                                                                            "query": "cat",
                                                                                            "boost": 0.15
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "category": {
                                                                                            "query": "cat",
                                                                                            "boost": 0.525
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "category.plain": {
                                                                                            "query": "cat",
                                                                                            "boost": 0.175
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "redirect.title": {
                                                                                            "query": "cat",
                                                                                            "boost": 0.375
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "redirect.title.plain": {
                                                                                            "query": "cat",
                                                                                            "boost": 0.125
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "heading": {
                                                                                            "query": "cat",
                                                                                            "boost": 1
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "heading.plain": {
                                                                                            "query": "cat",
                                                                                            "boost": 1
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "auxiliary_text": {
                                                                                            "query": "cat",
                                                                                            "boost": 0.225
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "auxiliary_text.plain": {
                                                                                            "query": "cat",
                                                                                            "boost": 0.075
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "text": {
                                                                                            "query": "cat",
                                                                                            "boost": 0.3
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "text.plain": {
                                                                                            "query": "cat",
                                                                                            "boost": 0.1
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "file_text": {
                                                                                            "query": "cat",
                                                                                            "boost": 0.15
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "file_text.plain": {
                                                                                            "query": "cat",
                                                                                            "boost": 0.05
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "suggest": {
                                                                                            "query": "cat",
                                                                                            "boost": 1
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "descriptions.de.plain": {
                                                                                            "query": "cat",
                                                                                            "boost": 2.5
                                                                                        }
                                                                                    }
                                                                                }
                                                                            ]
                                                                        }
                                                                    }
                                                                ]
                                                            }
                                                        },
                                                        {
                                                            "dis_max": {
                                                                "queries": [
                                                                    {
                                                                        "match": {
                                                                            "statement_keywords": {
                                                                                "query": "P999=Q1",
                                                                                "boost": 20
                                                                            }
                                                                        }
                                                                    }
                                                                ]
                                                            }
                                                        }
                                                    ]
                                                }
                                            },
                                            "boost_mode": "replace",
                                            "functions": [
                                                {
                                                    "script_score": {
                                                        "script": {
                                                            "source": "100 \/ ( 1 + exp( -1 * ( _score + intercept ) ) )",
                                                            "params": {
                                                                "intercept": 1
                                                            },
                                                            "lang": "expression"
                                                        }
                                                    }
                                                }
                                            ]
                                        }
                                    },
                                    {
                                        "function_score": {
                                            "query": {
                                                "bool": {
                                                    "minimum_should_match": 1,
                                                    "should": [
                                                        {
                                                            "dis_max": {
                                                                "tie_breaker": 1,
                                                                "queries": [
                                                                    {
                                                                        "bool": {
                                                                            "minimum_should_match": 0,
                                                                            "filter": [
                                                                                {
                                                                                    "multi_match": {
                                                                                        "query": "dog",
                                                                                        "fields": [
                                                                                            "all",
                                                                                            "all.plain"
                                                                                        ],
                                                                                        "operator": "and"
                                                                                    }
                                                                                }
                                                                            ],
                                                                            "should": [
                                                                                {
                                                                                    "match": {
                                                                                        "title": {
                                                                                            "query": "dog",
                                                                                            "boost": 0.45
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "title.plain": {
                                                                                            "query": "dog",
                                                                                            "boost": 0.15
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "category": {
                                                                                            "query": "dog",
                                                                                            "boost": 0.525
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "category.plain": {
                                                                                            "query": "dog",
                                                                                            "boost": 0.175
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "redirect.title": {
                                                                                            "query": "dog",
                                                                                            "boost": 0.375
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "redirect.title.plain": {
                                                                                            "query": "dog",
                                                                                            "boost": 0.125
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "heading": {
                                                                                            "query": "dog",
                                                                                            "boost": 1
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "heading.plain": {
                                                                                            "query": "dog",
                                                                                            "boost": 1
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "auxiliary_text": {
                                                                                            "query": "dog",
                                                                                            "boost": 0.225
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "auxiliary_text.plain": {
                                                                                            "query": "dog",
                                                                                            "boost": 0.075
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "text": {
                                                                                            "query": "dog",
                                                                                            "boost": 0.3
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "text.plain": {
                                                                                            "query": "dog",
                                                                                            "boost": 0.1
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "file_text": {
                                                                                            "query": "dog",
                                                                                            "boost": 0.15
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "file_text.plain": {
                                                                                            "query": "dog",
                                                                                            "boost": 0.05
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "suggest": {
                                                                                            "query": "dog",
                                                                                            "boost": 1
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "descriptions.de.plain": {
                                                                                            "query": "dog",
                                                                                            "boost": 2.5
                                                                                        }
                                                                                    }
                                                                                }
                                                                            ]
                                                                        }
                                                                    }
                                                                ]
                                                            }
                                                        },
                                                        {
                                                            "match_none": {}
                                                        }
                                                    ]
                                                }
                                            },
                                            "boost_mode": "replace",
                                            "functions": [
                                                {
                                                    "script_score": {
                                                        "script": {
                                                            "source": "100 \/ ( 1 + exp( -1 * ( _score + intercept ) ) )",
                                                            "params": {
                                                                "intercept": 1
                                                            },
                                                            "lang": "expression"
                                                        }
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                ],
                                "must_not": [
                                    {
                                        "function_score": {
                                            "query": {
                                                "bool": {
                                                    "minimum_should_match": 1,
                                                    "should": [
                                                        {
                                                            "dis_max": {
                                                                "tie_breaker": 1,
                                                                "queries": [
                                                                    {
                                                                        "bool": {
                                                                            "minimum_should_match": 0,
                                                                            "filter": [
                                                                                {
                                                                                    "multi_match": {
                                                                                        "query": "donkey",
                                                                                        "fields": [
                                                                                            "all",
                                                                                            "all.plain"
                                                                                        ],
                                                                                        "operator": "and"
                                                                                    }
                                                                                }
                                                                            ],
                                                                            "should": [
                                                                                {
                                                                                    "match": {
                                                                                        "title": {
                                                                                            "query": "donkey",
                                                                                            "boost": 0.45
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "title.plain": {
                                                                                            "query": "donkey",
                                                                                            "boost": 0.15
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "category": {
                                                                                            "query": "donkey",
                                                                                            "boost": 0.525
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "category.plain": {
                                                                                            "query": "donkey",
                                                                                            "boost": 0.175
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "redirect.title": {
                                                                                            "query": "donkey",
                                                                                            "boost": 0.375
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "redirect.title.plain": {
                                                                                            "query": "donkey",
                                                                                            "boost": 0.125
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "heading": {
                                                                                            "query": "donkey",
                                                                                            "boost": 1
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "heading.plain": {
                                                                                            "query": "donkey",
                                                                                            "boost": 1
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "auxiliary_text": {
                                                                                            "query": "donkey",
                                                                                            "boost": 0.225
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "auxiliary_text.plain": {
                                                                                            "query": "donkey",
                                                                                            "boost": 0.075
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "text": {
                                                                                            "query": "donkey",
                                                                                            "boost": 0.3
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "text.plain": {
                                                                                            "query": "donkey",
                                                                                            "boost": 0.1
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "file_text": {
                                                                                            "query": "donkey",
                                                                                            "boost": 0.15
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "file_text.plain": {
                                                                                            "query": "donkey",
                                                                                            "boost": 0.05
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "suggest": {
                                                                                            "query": "donkey",
                                                                                            "boost": 1
                                                                                        }
                                                                                    }
                                                                                },
                                                                                {
                                                                                    "match": {
                                                                                        "descriptions.de.plain": {
                                                                                            "query": "donkey",
                                                                                            "boost": 2.5
                                                                                        }
                                                                                    }
                                                                                }
                                                                            ]
                                                                        }
                                                                    }
                                                                ]
                                                            }
                                                        },
                                                        {
                                                            "dis_max": {
                                                                "queries": [
                                                                    {
                                                                        "match": {
                                                                            "statement_keywords": {
                                                                                "query": "P999=Q2",
                                                                                "boost": 20
                                                                            }
                                                                        }
                                                                    }
                                                                ]
                                                            }
                                                        }
                                                    ]
                                                }
                                            },
                                            "boost_mode": "replace",
                                            "functions": [
                                                {
                                                    "script_score": {
                                                        "script": {
                                                            "source": "100 \/ ( 1 + exp( -1 * ( _score + intercept ) ) )",
                                                            "params": {
                                                                "intercept": 1
                                                            },
                                                            "lang": "expression"
                                                        }
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                ]
                            }
                        }
                    ],
                    "minimum_should_match": 1
                }
            }
        ],
        "filter": [
            {
                "terms": {
                    "namespace": [
                        0
                    ]
                }
            }
        ]
    }
}