Skip to content

Instantly share code, notes, and snippets.

@phondanai
Last active June 13, 2023 07:03
Show Gist options
  • Save phondanai/318d78a35571e1231a38131636b0afcb to your computer and use it in GitHub Desktop.
Save phondanai/318d78a35571e1231a38131636b0afcb to your computer and use it in GitHub Desktop.

Open Search Cheat Sheet

Search with total size and sorting by timestamp

GET <index>/_search
{
  "size": 30,
  "query": {
    "match_all": {}
  },
  "sort" : [{ "@timestamp" : "desc" }]
}

Delete a document by it's id

DELETE <index>/_doc/<doc_id>
{}

Show mapping of your index

GET /<index>/_mapping
{
  "query": {
    "match_all": {}
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment