Elastic Search nested multimatch query

后端 未结 2 1639
谎友^
谎友^ 2020-12-31 02:27

So my problem is basically the same as described here, however it still remains unanswered on the group.

My mapping:

{
    \"abstract\": {
        \"         


        
2条回答
  •  执念已碎
    2020-12-31 03:13

    The only solution that I managed to work out, which is not handy nor elegant but somehow works is such query:

    "query": {
        "bool": {
            "should": [
                {
                    "nested": {
                        "path": "authors",
                        "query": {
                            "multi_match": {
                                "query": "higgs",
                                "fields": ["last_name^2"]
                            }
                        }
                    } 
                },
                {
                    "multi_match": {
                        "query": "higgs",
                        "fields": ["abstract.summary^5"]
                    }
                }
            ]
        }
    }
    

    I'm also not sure if the boosting will work as expected, providing it's set in different queries. Any suggestions appreciated.

提交回复
热议问题