Skip to content

Instantly share code, notes, and snippets.

@aravindputrevu
Created March 23, 2021 14:21
Show Gist options
  • Save aravindputrevu/0e8eae45c84c5a0d3e9ef5d444d22405 to your computer and use it in GitHub Desktop.
Save aravindputrevu/0e8eae45c84c5a0d3e9ef5d444d22405 to your computer and use it in GitHub Desktop.
Data streams Example

#list all indices GET _cat/indices

#Creating Data stream PUT _data_stream/first-data-stream

GET _index_template/

GET my-data-stream/_search

GET _cat/indices

#indexing data, "create" is only op_type supported. POST my-data-stream/_doc { "@timestamp" : "2021-05-17T11:04:05.000Z", "username": "aravindputrevu", "message": "created new record in new data stream" }

POST my-data-stream/_rollover

POST my-data-stream/_doc { "@timestamp" : "2021-05-17T11:04:05.000Z", "username": "aravind", "message": "created new record in new index" }

#Recommended data stream naming convention

--

PUT _data_stream/metrics-redis-server-production

#updating data in a data stream POST my-data-stream/_update_by_query { "query": { "match": { "username": "aravindputrevu" } }, "script": { "source": "ctx._source.username = params.new_username", "params": { "new_username": "aravind" } } }

GET _data_stream/my-data-stream/_stats/

DELETE _data_stream/my-data-stream

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