Hi,
I have timestamp of a column is like below. For example
2019/04/30 Tuesday 08:00:00
How should I define properties for index mapping
Hi,
I have timestamp of a column is like below. For example
2019/04/30 Tuesday 08:00:00
How should I define properties for index mapping
"type" : "date", "format" :"yyyy/MM/dd EEEE HH:mm:ss"
Thank you David
Hi David,
I am not able to visualize data in the kibana.
Could you verify this python client code.
es.indices.put_mapping(
index=index_name,
doc_type=doctype,
ignore=400,
body={
doctype: {
"properties": {
"@timestamp": {
"type": "date",
"format": "yyyy/MM/dd EEEE HH:mm:ss"
},
"Load in kW": {
"type": "float"
}
}
}
}
)
for row in reader:
try:
if(index == 0):
headers = row
else:
obj = {}
for i, val in enumerate(row):
if i == 0:
a = datetime.datetime.strptime(val,"%Y/%m/%d %A %H:%M:%S")
obj[headers[i]] = a
else:
obj[headers[i]] = float(val)
print(obj)
# put document into elastic search
es.index(index=index_name, doc_type=doctype, body=obj)
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.