Hi,
Im running kibana5.4 and ES 5.4
I have data like this sensor_data : 3, 5, 4 and I need to do aggregation on each number.
Mapping for this field is ("type": "long")
When I'm trying to filter sensor_data:"3, 5, 4" Kibana is giving an error
It will be better solution for me to do scripted fields by selecting index for array but script like this is giving error
doc["sensor_data"].value[1]
And script like this taking first array value
doc["sensor_data"].value (this will return me 3)
You would probably have a better experience if you pre-processed this sensor data to give names to each value, but you can access these values with painless with a script like this:
doc['sensor_data'][0] // for 3
doc['sensor_data'][1] // for 4
doc['sensor_data'][2] // for 5
Thank you for response @spalger
I tried that on this data : 0, 1, 0
doc['sensor_data'][0] // value 0
doc['sensor_data'][1] // value 0
doc['sensor_data'][2] // value 1
and for this
1, 0, 0
doc['sensor_data'][0] // value 0
doc['sensor_data'][1] // value 0
doc['sensor_data'][2] // value 1
And the same for
0, 0, 1
doc['sensor_data'][0] // value 0
doc['sensor_data'][1] // value 0
doc['sensor_data'][2] // value 1
Why this work like this ?
Interesting, perhaps it's sorting the values before injecting them... I don't have access to a testing environment at this moment, but can you try accessing doc._source? This doc seems to imply that it should be available, which should have the values as they were passed when you originally indexed the doc.
You would probably be better off pre-processing the data in something like logstash before indexing it into Elasticsearch. If you don't have that option then perhaps you can index the data as a string and then split the string in painless, converting it to an ordered list once you need it.
@spalger I have no option to preprocess the data we already have a lot of data in ES like that
I tried to do this
doc._source.sensor_data
_source.sensor_data
It giving me an error (Discover: compile error, other one runtime error)
I will be very thankful if you help me to solve this.
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.