# Bool search must\_not is not useful

**URL:** https://discuss.elastic.co/t/bool-search-must-not-is-not-useful/124041
**Category:** Elasticsearch
**Created:** [March 15, 2018, 7:54am UTC](https://discuss.elastic.co/t/bool-search-must-not-is-not-useful/124041 "2018-03-15T07:54:07Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![shockerY](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@shockerY](https://discuss.elastic.co/u/shockerY)
#### Post date: [March 15, 2018, 7:54am UTC](https://discuss.elastic.co/t/bool-search-must-not-is-not-useful/124041/1 "2018-03-15T07:54:07Z")

</div>

**I use bool to search,it like this:**

```auto
{
    "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:**

```auto
{
  "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?**

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [March 15, 2018, 9:33am UTC](https://discuss.elastic.co/t/bool-search-must-not-is-not-useful/124041/2 "2018-03-15T09:33:31Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.

Please don't post images of text as they are hardly readable and not searchable.

Please update your post.

---

<div class="post-metadata">

### Author: ![shockerY](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@shockerY](https://discuss.elastic.co/u/shockerY)
#### Post date: [March 16, 2018, 3:44am UTC](https://discuss.elastic.co/t/bool-search-must-not-is-not-useful/124041/5 "2018-03-16T03:44:22Z")

</div>

I'm grateful for your guidance.Thank you, I fell sorry about that,I updated it.

---

<div class="post-metadata">

### Author: ![shockerY](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@shockerY](https://discuss.elastic.co/u/shockerY)
#### Post date: [March 16, 2018, 3:44am UTC](https://discuss.elastic.co/t/bool-search-must-not-is-not-useful/124041/6 "2018-03-16T03:44:59Z")

</div>

Thanks again, I should respect people who read more.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 13, 2018, 3:45am UTC](https://discuss.elastic.co/t/bool-search-must-not-is-not-useful/124041/7 "2018-04-13T03:45:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
