Changing all array elements in scripted field


(Elad Sheinfeld) #1

I'm trying to use Kibana's "index patterns" -> "scripted fields" to manipulate the values of indexed fields.
When using either of the following script I am getting all the elements copied to the new scripted index:
doc['EntityTigerDestLong'].values
also, if I want to change only one value in the array, I can:
doc['EntityTigerDestLong'].values[0]+1

but I don't know how to change all the values at once.


Scripted Field for elements inside lists of JSON objects
(Thomas Neirynck) #2

hi @elad_sheinfeld

seems like you'd have to write a loop to do this.

For a template, see here:
https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting-painless.html#_accessing_doc_values_from_painless

thx,


(Elad Sheinfeld) #3

Yep, that solved it !
thanks


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.