Skip to content

Instantly share code, notes, and snippets.

@rasathus
Created October 29, 2014 18:42
Show Gist options
  • Save rasathus/b46207391c0ee41a08e1 to your computer and use it in GitHub Desktop.
Save rasathus/b46207391c0ee41a08e1 to your computer and use it in GitHub Desktop.
elasticsearch append to array
"script": "ctx._source.Tracking += Tracking",
"params": {
"Tracking": [ { "Timestamp": datetime.datetime.now(), "Entry": tracking['Entry'], "SystemId": system_id} ]
}
@rasathus
Copy link
Author

In case anyone stumbles accross this, the Status section can be overwritten via the addition of a script too.

                "script": "ctx._source.Tracking += Tracking; ctx._source.Status = Status",
                "params": {
                    "Status": entry_status_map[entry_lower],
                    "Tracking": [ { "Timestamp": datetime.datetime.now(), "Entry": tracking['Entry'], "SystemId": system_id} ]
                }

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