Hi @Yang, Steven ,
you have to filter your result set a second time to get rid of the NOT
-lines in the string.
For instance like this:
let Example = datatable(Query:string)[
"String1: should be in the output. Keyterm:OUTPUTVIEW",
"String2: should be in the output. Keyterm:OUTPUTVIEW",
"String3: should be in the output. Keyterm:OUTPUTVIEW",
"String4: should be in the output. Keyterm:IMPORTANT",
"String5: should NOT be in the output. Keyterm:OUTPUTVIEW_NOT",
"String6: should NOT be in the output. Keyterm:OUTPUTVIEW-NOT"
];
Example
| where Query has_any (dynamic(["OUTPUTVIEW", "IMPORTANT"]))
| where Query !has "NOT"
or
let Example = datatable(Query:string)[
"String1: should be in the output. Keyterm:OUTPUTVIEW",
"String2: should be in the output. Keyterm:OUTPUTVIEW",
"String3: should be in the output. Keyterm:OUTPUTVIEW",
"String4: should be in the output. Keyterm:IMPORTANT",
"String5: should NOT be in the output. Keyterm:OUTPUTVIEW_NOT",
"String6: should NOT be in the output. Keyterm:OUTPUTVIEW-NOT"
];
Example
| where Query has_any (dynamic(["OUTPUTVIEW", "IMPORTANT"]))
| where Query !contains "NOT"
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards Andreas Baumgarten