Trying to come up with a query to search "message" field for something like "Hello" and also the field must not contain strings like "Test" "TestProcess". "UpdatingTestProcess"
Below are sample messages:
Message: Hello TestProcess is initiated.
Message: Hello SomeOtherProcess is initiated.
Message: UpdatingTestProcess is processing Hello data.
Message: SomeOtherProcess is processing Hello data.
Message: Hello TestUpdateProcess is successful in process Hello data.
Message: SomeOtherProcess is successful in process Hello data.
Message: Waiting for processes to complete their work.
Hello is there in all the above message except last messages and I am only interested in fetching message 2, 4 and 6 and ignore message 1, 3, and 5 which contain "Test" string. I also ignore last message as it doesn't contain "Hello" String
I tried below query but it didn't work and it is fetching message 1 through 6 and ignoring just 7th message.
{
"query": {
"bool": {
"must": [
{
"match": {
"message": {
"query": "Hello"
}
}
}
],
"must_not": [
{
"terms": {
"message": [
{
"query": "Test"
}
]
}
}
]
}
}
}