I would like to remove any "| Brand" occurrences in the title field in such results.
What script should I use?
I tried painless scripts
String title = doc['title'].value;
if (title != null) {
// Use replaceAll to remove all occurrences of "| abc def"
return title.replaceAll('\|\sabc\sdef', '');
}
return ''; // Return an empty string if title is null
But I think the logic is incorrect.
Let me know if I should use use Kibana, ingestion API or anything else, I'm not a dev, but I do know how to get around the platform, so do need some step instructions.
I tried painless String title = doc['title'].value;
if (title != null) {
// Use replaceAll to remove all occurrences of "| Brand AB"
return title.replaceAll('|\sBrand\sAB', '');
}
return ''; // Return an empty string if title is null
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.