Hi, I am having trouble splitting a string using painless to create a new field. I have a string like:
doc['path.keyword'].value = 'N:/divtaxbacktest/Comp/divbacktest/SMEA.L.csv';
And I would like to extract SMEA.L, so I am trying to first split the string and use substring as such:
String parts = ///.split(doc['path'].value);
return parts[3].substring( 0, -4 );
Ok. Please be aware that it will be slow in comparison of doing that at index time (using ingest or not).
May I ask what is your goal at the end?
Also could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.
A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.
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.