Skip to content

Instantly share code, notes, and snippets.

@martinhynar
Last active August 29, 2015 14:08
Show Gist options
  • Save martinhynar/1c492ec616e2e536cdde to your computer and use it in GitHub Desktop.
Save martinhynar/1c492ec616e2e536cdde to your computer and use it in GitHub Desktop.
Update existing document in ES?

Have existing document already in ES

{
  "service" : "A",
  "timestamp" : "2014-06-06T12:12:59.456+00:00"
}

and want to update it to get this

{
  "service" : "A",
  "timestamp" : "2014-06-06T12:11:59.456+00:00",
  "mapping" : [
    {"subcmd":"X", "finished":"2014-06-06T18:12:59.456+00:00", "status" : "success"},
    {"subcmd":"Y", "finished":"2014-06-06T18:13:59.456+00:00", "status" : "failed"}
  ]
}

What else, other than dynamic script, could I use to get this with one request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment