Truncate part of an existing url field value to a new field using painless?

i have a requirement where i have to trim field based on url i have to trim until rules /someapi/api/v4/bdq/rules/16869

Take a look at ingest scripts: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/script-processor.html

For existing documents, you'll want to look at update by query

looking for something like this

def path = doc['internalUri.keyword'].contains('v*');
/which will retrieve all paths which contains word v3,v2,v1/
if (path != null) {
return path.Substring(1,23);
abstract only v3 from path
}
return "";

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