Get Free Trial
Get Free Trial

How to use data type with Elasticsearch

Hi,
It’s possible to use datatype (DATE) with Elasticsearch?
That’s what I’m trying to do.

"dataSource": {		
"dataSourceType": "elasticsearch",
"host": "http://192.168.0.204:9200",
"index": "pdg",
"mappings": {
"TERM_DT": {
"type": "datetime"
}
}
}

 

3 answers

Public
Vera Didenko Flexmonster April 18, 2019

Hello, Mario,
 
Thank you for your question.
 
It’s possible to use datatype (DATE) with Elasticsearch without specifying in mapping explicitly.
We kindly advise using the mapping property to modify how the data is represented.
 
For example: 

mapping: {
"@timestamp": {
"format": "dd/MM/yyyy"
}
}

(Please see more about the mapping property here: https://www.flexmonster.com/api/report-object/ ) 
 
 
Our team has prepared a JSFiddle example for illustration.
 
 
Please let us know if this works for you and if you have further questions.

Best Regards,
Vera

Public
MARIO FRANCESCO VALENTINO CORREA CAVACIOCCHI April 18, 2019

Thx ! It work’s. 
Complementing my question, how to make the filter behavior like this example?
 
https://jsfiddle.net/flexmonster/h4qzupbb/

Public
Vera Didenko Flexmonster April 19, 2019

Hello, Mario,
 
Thank you for the update.

We are glad to hear that everything works.
 
We would like to make sure if we understood your question correctly:
You are interested in the range filter?

The range filter is currently available for CSV/JSON only.

For Elasticsearch, we suggest using filtering by members.
 
Please let us know if you have further questions.

Best Regards,
Vera

Please login or Register to Submit Answer