get total count of messages in ElasticSearch index filtered by field
<p>I would like to get a total count of messages for a given time period by querying the elasticsearch API and filtering by a specific field. </p>

<pre><code>GET /logstash-2016.11.23/_count
{
"query": {
    "bool" : {
        "should" : [
            {
                "term": { "_type":"streams_blog_out"}
            },
            {
                "range": {
                    "timestamp": {
                        "from": "2016-11-22T00:00:00",
                        "to": "2016-11-23T00:00:00"
                    }
                }
            }
        ]
    }
   }
 }
</code></pre>

<p>this gives me:</p>

<pre><code>  {
    "count": 1377737,
    "_shards": {
    "total": 5,
    "successful": 5,
   "failed": 0
   }
  }
</code></pre>

<p>EDIT 2:</p>

<p>getting error:  nested: QueryParsingException[[logstash-2016.11.23] request does not support [highlight]]; "</p>

<pre><code>{
 "query": {
  "filtered": {
  "query": {
    "query_string": {
      "query": "_type:streams_blogs_out",
      "analyze_wildcard": true
    }
  },
  "filter": {
    "bool": {
      "must": [
        {
          "range": {
            "@timestamp": {
              "gte": 1479790800000,
              "lte": 1479877199999
            }
          }
        }
      ],
      "must_not": []
    }
    }
  }
},
 "highlight": {
 "pre_tags": [
  "@kibana-highlighted-field@"
  ],
  "post_tags": [
  "@/kibana-highlighted-field@"
  ],
  "fields": {
  "*": {}
   },
   "fragment_size": 2147483647
  },
 "size": 500,
 "sort": [
  {
  "@timestamp": {
    "order": "desc",
    "unmapped_type": "boolean"
    }
  }
 ],
 "aggs": {
  "2": {
  "date_histogram": {
    "field": "@timestamp",
    "interval": "30m",
    "pre_zone": "-05:00",
    "pre_zone_adjust_large_interval": true,
    "min_doc_count": 0,
    "extended_bounds": {
      "min": 1479790800000,
      "max": 1479877199999
    }
    }
  }
},
 "fields": [
 "*",
 "_source"
 ],
  "script_fields": {},
  "fielddata_fields": []
 }
</code></pre>

<p>EDIT 3:</p>

<p>corrected request:</p>

<pre><code>{
 "query": {
  "filtered": {
   "query": {
     "query_string": {
      "query": "_type:streams_blogs_out",
      "analyze_wildcard": true
      }
    },
    "filter": {
    "bool": {
      "must": [
        {
          "range": {
            "@timestamp": {
              "gte": 1479790800000,
              "lte": 1479877199999
            }
          }
        }
      ],
      "must_not": []
     }
   }
 }
 }
}
</code></pre>