{
"_index" : "testcases",
"_type" : "_doc",
"_id" : "Cv6z8HoBF-BJEaLQYGtU",
"_score" : 1.0,
"_source" : {
"buildVersion" : "1.16.3-alpha+9950",
"testcase" : {
"$" : {
"name" : "/opt/fireglass/1.16.3-alpha+9950/regression_tests/out/cases/activity_logs/basic_activity_logs_search.js - Basic activity log search Activity log search after browsing Contains a log with events 'Network Request' and 'Forward To Isolation",
"time" : "14.583",
"className" : "Contains a log with events 'Network Request' and 'Forward To Isolation"
}
},
"testcaseName" : "Basic activity log search Activity log search after browsing Contains a log with events 'Network Request' and 'Forward To Isolation" (18),
"testcaseStatus" : "Passed",
"timestamp" : "2021-07-29T05:18:45.071Z"
}
}
In the testcaseName field there is an index in brackets, for example "(18)".
I want to run on all documents in the DB on testcaseName field and search for testcaseName that contain this index and remove it.
For example:
"testcaseName" : "Basic activity log search Activity log search after browsing Contains a log with events 'Network Request' and 'Forward To Isolation" (18)
Will become:
"testcaseName" : "Basic activity log search Activity log search after browsing Contains a log with events 'Network Request' and 'Forward To Isolation"
Just remove the "(18)"
I did it in my code to prevent it happen again, but I need to fix the DB as well.
javascript code:
let newTestName = testName;
// Find number in parenthesis with space (if exist) before as example: " (33)"
const match = testName.match(/\s?\([0-9]+\)/gm);
if (match !== null) {
// Get only the last finding
const matchPattern = match[match.length - 1];
const endIndex = testName.lastIndexOf(matchPattern);
newTestName = testName.substring(0, endIndex);
}
How to do the same in Elastic? A query in Dev Tools or should I write code in order to that?
If there is a way to do it from Dev tools let me know how?
The doc recognized by ES is JSON,but this is not a json,How do you save it into es?
"testcaseName" : "Basic activity log search Activity log search after browsing Contains a log with events 'Network Request' and 'Forward To Isolation" (18),
"testcaseName" : "Basic activity log search Activity log search after browsing Contains a log with events 'Network Request' and 'Forward To Isolation (18)"
to:
"testcaseName" : "Basic activity log search Activity log search after browsing Contains a log with events 'Network Request' and 'Forward To Isolation"
First of all, thank you very much for your response.
I see you wrote _simulate, so this script just do a simulation? If I really want to change the data I use _update instead?
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.