简体   繁体   English

Elastic Search (5.0) 过滤上下文术语查询不起作用

[英]Elastic Search (5.0) filter context term query is not working

I have a filter query as shown below.我有一个过滤器查询,如下所示。 I intend to filter on stripped-blocked-uri (exact match) which is not working,我打算过滤不起作用的剥离阻塞uri(精确匹配),

{
    "query": {
        "bool": {
            "filter": [
                {
                    "term": {
                        "stripped-blocked-uri": "https://www.twitter.com:9090"
                    }
                },
                {
                    "term": {
                        "project-id": "1"
                    }
                },
                {
                    "term": {
                        "rule-id": "101"
                    }
                }
            ]
        }
    }
}

which is returning no hits.这是返回没有命中。

My mapping is,我的映射是,

                    "stripped-blocked-uri": {
                        "type": "text",
                        "fields": {
                            "keyword": {
                                "type": "keyword",
                                "ignore_above": 256
                            }
                        }
                    },

Not sure what is going wrong here.不知道这里出了什么问题。 Please help!请帮忙!

Use the keyword field:使用keyword字段:

{
    "query": {
        "bool": {
            "filter": [
                {
                    "term": {
                        "stripped-blocked-uri.keyword": "https://www.twitter.com:9090"
                    }
                },
                {
                    "term": {
                        "project-id": "1"
                    }
                },
                {
                    "term": {
                        "rule-id": "101"
                    }
                }
            ]
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM