I use bool to search,it like this:
{
"query": {
"bool": {
"must": {
"match": {
"message": {
"query": "disconnect"
}
}
},
"must": {
"match": {
"message": {
"query": "server"
}
}
},
"must_not": {
"match": {
"message": {
"query": "pomelo_list"
}
}
},
"must_not": {
"match": {
"message": {
"query": "socket"
}
}
},
"filter": {
"range": {
"@timestamp": {
"gte": "2018-03-15T07:21:56.950Z"
}
}
}
}
}
}
the search result like this:
{
"took": 49,
"timed_out": false,
"_shards": {
"total": 109,
"successful": 109,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 8.321762,
"hits": [
{
"_index": "vrmmo_index_031203",
"_type": "logs",
"_id": "AWIoiWnwz80RW__iJ7Gr",
"_score": 8.321762,
"_source": {
"@version": "1",
"host": "Dell7020-5147",
"@timestamp": "2018-03-15T07:21:56.950Z",
"message": "server disconnect\r"
}
},
{
"_index": "vrmmo_index_031203",
"_type": "logs",
"_id": "AWIoix8_z80RW__iJ7WF",
"_score": 7.960806,
"_source": {
"@version": "1",
"host": "Dell7020-5147",
"@timestamp": "2018-03-15T07:23:48.907Z",
"message": "server [pomelo_list_1521095356265] disconnect\r"
}
}
]
}
}
We can see the second doc contain "pomelo_list" is in the result, why 'must_not: pomelo_list' is not useful?
I have a test, if "pomelo_list" in mesaage without "[ ]", must_not is worked.
How can i do to make the search result right?