Hi @emma84, we do not have at the moment a public demo for the streaming functionality, but in the future we will add it, for now, you can simulate a “near real-time” data, indexing manually documents to elasticsearch at custom time intervals and configure the Time Slider to play the data. For example, let see the how could be this idea “at big steps” in a python script:
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk, streaming_bulk
import time
import datetime
es = Elasticsearch()
index_name = 'myIndexName'
def getMappings():
mappings = {
"transactions": {
"properties": {
"timestamp": {
"type": "date",
"format": "yyyy-MM-ddThh:mm:ss.SSSSSS"
},
...
}
}
}
return mappings
}
def createIndex(client):
doc = {
"settings" : {
"number_of_shards" : 1
},
"mappings" : getMappings()
}
client.indices.create(index=index_name, ignore=[400, 404], body=doc)
}
def create_doc(r, time):
return {
"timestamp": time.isoformat(),
...
}
create_index(es)
count = 0
while True:
now = datetime.datetime.now()
doc = create_doc(rowData, now)
es.index(index=index_name, id=count, doc_type='transactions', body=doc)
count += 1
time.sleep(yourCustomInreval)
Now you can create your Time Slider component with a similar configuration:
let field = cf.Attribute("timestamp").func("SECOND");
cf.provider("YourDataProvider")
.source('YourDataSource')
.timeField(field)
.graph("Time Slider")
.set("player", {
'step-unit': 'day',
'step': 1,
'refresh': 2,
'pin-left': true,
'live': true,
'autoplay': true,
})
.execute();
Note that this code is not intended to be executable, is just a guide. Let me know if something is not clear or not work in your implementation. Best regards.