Elasticsearch Query Samples

Here are the list of the sample Elastic Log quarries for reference.

Query to show elastic - 100 log documents
{
  "query": {
     "match_all": {}
   },
   "size": 100
}
Query to fetch Elastic Logs for last 30 days
{
  "query": {
    "bool": {
      "must": {
        "range": {
          "date": {
            "gte": "now-30d"
          }
        }
      }
    }
  }
}


Create query with input {0} to insert issue key
{
  "query": {
    "multi_match": {
      "query": "{0}",
      "fields": [
        "issueKey",
        "message"
      ],
      "operator": "or"
    }
  }
}


Query for search theme
{
  "query": {
    "multi_match": {
      "query": "{0}",
      "fields": [
        "issueKey",
        "message"
      ],
      "operator": "or"
    }
  }
}