How to get the count of the documents inside term aggregation that have doc_count as 1?

POST alertbrowser/_search?size=0
{
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "projectId.keyword": "aasish-webdemo-1-1498031057532"
          }
        }
      ],
      "filter": [{
        "range": {
          "page.time": {
            "gte": "now-M",
            "lte": "now"
          }
        }
      },
      {
          "term":{
            "page.url.keyword":"http://192.168.0.7:8080/WebTest/gallery.html"
          }
        }
      ]
    }
  },
  "aggs": {
    "bouncerate": {
      "terms": {
        "field": "sId.keyword"
      }
    }
  }
}

below is the output of the query the

    {
      "took": 326,
      "timed_out": false,
      "_shards": {
        "total": 5,
        "successful": 5,
        "skipped": 0,
        "failed": 0
      },
      "hits": {
        "total": 17,
        "max_score": 0,
        "hits": []
      },
      "aggregations": {
        "bouncerate": {
          "doc_count_error_upper_bound": 0,
          "sum_other_doc_count": 2,
          "buckets": [
            {
              "key": "f65sqj9du1513236322891",
              "doc_count": 3
            },
            {
              "key": "6jlcfm4nj1513157936282",
              "doc_count": 2
            },
            {
              "key": "l337tse5b1512719799692",
              "doc_count": 2
            },
            {
              "key": "qiop98b0n9g951cbl",
              "doc_count": 2
            },
            {
              "key": "c467ag4co1513055629501",
              "doc_count": 1
            },
            {
              "key": "e8y8z1zvl1513054886050",
              "doc_count": 1
            },
            {
              "key": "fp5ouwbj61513158038697",
              "doc_count": 1
            },
            {
              "key": "iiumkslaf1513056775697",
              "doc_count": 1
            },
            {
              "key": "ivy632gaj1512741980096",
              "doc_count": 1
            },
            {
              "key": "krvhewem41513226839187",
              "doc_count": 1
            }
          ]
        }
      }
    }

In the above query i aggregated the data based on the sId.keyword. in the output i want to get the count of how many documents inside the bucket have doc_count as 1?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.