小编ram*_*lev的帖子

Elasticsearch - 在没有特定字段的情况下对文档进行负面推动

我正在进行查询,基本过滤的多重匹配查询按计划工作,它返回我想要的文档.

问题是想要提升具有某个字符串字段的结果.0.5,或者在这个例子中给出没有该字段'traded_as'的结果为负增益1.0.

无法获得过滤器 - 提升 - 必须 - 存在/缺失按我的意愿工作.

这是解决这个问题的正确方法吗?

使用elasticsearch 1.5.2

{
"query": {
    "filtered": {
        "query": {
           "multi_match": {
               "query": "something",
               "fields": ["title", "url", "description"]
           }
        },
        "filter": {
           "bool": {
                "must": {
                    "missing": {
                        "field": "marked_for_deletion"
                    }
                }
            }
        }
    }
},
"boosting": {
    "positive": {
        "filter": {
            "bool": {
                "must": {
                    "exists": {
                        "field": "traded_as"                            
                    }
                }
            }
        }
    },
    "negative": {
        "filter": {
           "bool": {
                "must": {
                    "missing": {
                        "field": "traded_as"
                    }
                }
            }
        } …
Run Code Online (Sandbox Code Playgroud)

elasticsearch

7
推荐指数
1
解决办法
3930
查看次数

标签 统计

elasticsearch ×1