How to boost search based on index type in elasticsearch or lucene?

后端 未结 4 2089
逝去的感伤
逝去的感伤 2021-01-04 11:49

I have three food type indices \"Italian\", \"Spanish\", \"American\". When the user searches \"Cheese\", documents from \"Italian\" appear to come up at the top. Is it poss

4条回答
  •  再見小時候
    2021-01-04 12:30

    If querying several indices at once, it is possible to specify indices boost at the top level of object passed to Search API:

    curl -XGET localhost:9200/italian,spanish,american/_search -d '
    {
        "query":{"term":{"food_type":"cheese"}},
        "indices_boost" : {
            "ilalian" : 1.4,
            "spanish" : 1.3,
            "american" : 1.1
        }
    }'
    

    http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-index-boost.html#search-request-index-boost

提交回复
热议问题