如何在弹性搜索中的不同字段中忽略空间?

时间:2018-04-11 10:31:47

标签: elasticsearch

我发送请求:

POST http://localhost:9200/test1/_search?q=*193*

身体:

{
  "size" : 0,
   "aggs" : {
        "distinct_groups" : {
         "terms" : { "field" : "group",  "size" : 500}
    }
}
}

我收到了这个回复:

    "aggregations": {
        "distinct_groups": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
                             {
                    "key": "bank",
                    "doc_count": 4
                },
                {
                    "key": "2",
                    "doc_count": 2
                },
                {
                    "key": "3",
                    "doc_count": 1
                },
                {
                    "key": "5",
                    "doc_count": 1
                },
            ]
        }
    }
}

但在现场“团体”实际上存了银行2,银行3,银行5。 我如何只用这个字段得到回应?

我的映射:

https://pastebin.com/V4sPWfAV

示例我的文档如下:

{
  "group" : "bank 2",
  "type":"comment",
  "data":"second bank",
  "author":"author 2"
}

0 个答案:

没有答案