美文网首页elasticsearch
使用multi-search进行统计分析

使用multi-search进行统计分析

作者: 愚公300代 | 来源:发表于2016-09-30 17:19 被阅读54次

    1.请求

    curl -XGET ndb4:9200/mgobjectforsearch/aad0978d-0fde-4cb8-a8b6-000f9b550900/_msearch --data-binary "@requests"; echo
    

    2.返回

    {
        "responses": [
            {
                "took": 2,
                "timed_out": false,
                "_shards": {
                    "total": 8,
                    "successful": 8,
                    "failed": 0
                },
                "hits": {
                    "total": 95,
                    "max_score": 0,
                    "hits": []
                },
                "aggregations": {
                    "tags": {
                        "doc_count_error_upper_bound": 0,
                        "sum_other_doc_count": 0,
                        "buckets": [
                            {
                                "key": "Nigeria",
                                "doc_count": 95
                            }
                        ]
                    }
                }
            },
            {
                "took": 2,
                "timed_out": false,
                "_shards": {
                    "total": 8,
                    "successful": 8,
                    "failed": 0
                },
                "hits": {
                    "total": 318,
                    "max_score": 0,
                    "hits": []
                },
                "aggregations": {
                    "tags": {
                        "doc_count_error_upper_bound": 0,
                        "sum_other_doc_count": 0,
                        "buckets": [
                            {
                                "key": "Thailand",
                                "doc_count": 318
                            }
                        ]
                    }
                }
            }
        ]
    }
    

    3.请求格式

    {}
    { "size": 0, "query": { "terms": { "eceb64b5-c1dc-419d-a6b0-7abd8e2ec3d3|": [ "Kano"] } }, "aggs" : { "tags" : { "terms" : { "field" : "161efeb4-d143-4083-87c4-c28846c1472c|", "min_doc_count": 10, "size": 20 } } } }
    {}
    { "size": 0, "query": { "terms": { "eceb64b5-c1dc-419d-a6b0-7abd8e2ec3d3|": [ "Yala" ] } }, "aggs" : { "tags" : { "terms" : { "field" : "161efeb4-d143-4083-87c4-c28846c1472c|", "min_doc_count": 10, "size": 20 } } } }
    

    相关文章

      网友评论

        本文标题:使用multi-search进行统计分析

        本文链接:https://www.haomeiwen.com/subject/crfryttx.html