Can i get day wise data from elasticsearch?

if yes, how can i get day wise data?

Do you mean querying data from Elasticsearch for a specific day?

@EZprogramming
Yes

If you want to query for a specific day:

{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "@timestamp": "..."
          }
        }
      ]
    }
  }
}

if you want to query for a range in your timestamp I recommend using filter.

{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "<optional_field>": "..."
          }
        }
      ],
      "filter": [
        {
          "range": {
            "@timestamp": {
              "from": "now-10d/d",
              "to": "now"
            }
          }
        }
      ]
    }
  }
}

You can test these using Kibana Dev tools which is much easier than testing with Elasticsearch curl commands on the command line.

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