如何在Elasticsearch中的单个请求中搜索多个值(域名)?

时间:2018-03-26 11:09:57

标签: api elasticsearch

之前我已经这样做了(向elasticsearch添加了数据): -

**URL :** localhost:9200/testrdr/supp_domains/_bulk (Put request)

**Raw Data (json) :** 
{ "create" : { "_index" : "testrdr" } }
{ "domain-name": "r1.com" }
{ "create" : { "_index" : "testrdr"} }
{ "domain-name": "r2.com" }
............................................ upto "r100.com"

然后搜索单个域: -

**URL :** http://localhost:9200/testrdr/_search (Post request)

**Raw Data (json) :** 
                         {     
                           "query":{
                               "query_string":{
                                    "query":"r10.com",
                                        "default_operator": "and"
                                 }
                               }
                             }

Output was this : 
                {
                "took": 4,
                "timed_out": false,
                "_shards": {
                    "total": 5,
                    "successful": 5,
                    "skipped": 0,
                    "failed": 0
                },
                "hits": {
                    "total": 1,
                    "max_score": 11.104812,
                    "hits": [
                        {
                            "_index": "testrdr",
                            "_type": "supp_domains",
                            "_id": "SPvtSGIB_duJQL0ByfXm",
                            "_score": 11.104812,
                            "_source": {
                                **"domain-name": "r10.com"**
                            }
                        }
                    ]
                }
            }

正如您可以看到根据查询在输出中显示的单个文档。 现在我想搜索多个域名。手段,我想知道如果[r1.com,r20.com,r50.com]这三个域名是否退出?有效输出,如上一节

注意:我正在使用" Postman"申请发送请求

0 个答案:

没有答案