Elasticsearch Query Samples

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

Simple Queries
{
  "query": {
     "match_all": {}
   }
}
{
  "query": {
    "query_string": {
      "query": "greg"
    }
  },
  "_source": {
    "includes": [ "email", "first", "last", "country", "" ]
  },
  "size": 100
}
{
  "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"
    }
  }
}