# Bool OR term quey does not match any document

**URL:** <https://discuss.elastic.co/t/bool-or-term-quey-does-not-match-any-document/262908>\
**Category:** Elasticsearch\
**Created:** [February 1, 2021, 9:18pm UTC](https://discuss.elastic.co/t/bool-or-term-quey-does-not-match-any-document/262908 "2021-02-01T21:18:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JackMaarek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jackmaarek/32/83246_2.png) [@JackMaarek](https://discuss.elastic.co/u/JackMaarek)\
**Post date:** [February 1, 2021, 9:18pm UTC](https://discuss.elastic.co/t/bool-or-term-quey-does-not-match-any-document/262908/1 "2021-02-01T21:18:58Z")

</div>

Hello guys,

I am trying to dive into DDD architecture by implement CQRS and event sourcing pattern into my app. The app is a simple blog api with article management and user authentication. I'm using elastic to store my events and the read model in order to rebuild the article when a change is done and keep track change on it. Kind of a google docs feature.

My stack is based on golang, I'm using [go-elastic](https://github.com/elastic/go-elasticsearch) package for my api calls.(which is poorly documentated). I'm on a docker environment and everything's working well.

I have in elastic some documents referenced by a AggregateID on which I want to make exact search in order to find all the associated events. Here's an example of a event document:

```auto
"_index": "article",
  "_type": "_doc",
  "_id": "kNXgXncBOgKHbob1dOxQ",
  "_version": 1,
  "_score": null,
  "_source": {
    "AggregateID": "7c2416a3-3985-4be5-928a-6091f491a41e",
    "Typology": "create",
    "Payload": {
      "AuthorID": 1,
      "Title": "ARTICLE TEST",
      "Content": "NEW CONTENT",
      "CreatedAt": "2021-02-01T18:35:04.1405348Z"
    },
    "CreatedAt": "2021-02-01T18:35:04.1405624Z",
    "Index": 1
  },
  "fields": {
    "CreatedAt": [
      "2021-02-01T18:35:04.140Z"
    ],
    "Payload.CreatedAt": [
      "2021-02-01T18:35:04.140Z"
    ]
  },
  "sort": [
    1612204504140
  ]
}

```

When i'm running my query nothing appears I have read the documentation several times and concluded that to find the exact AggregateID I should use a bool query:

```auto
{
    "query": {
        "bool": {
            "must": {
               "term": {
                    "AggregateID": "7c2416a3-3985-4be5-928a-6091f491a41e"
                }
            }
        }
    }
}

```

I also tried a term query but still the same I do not understand why only match queries are working.

```auto
{
    "query": {
        "term": {
            "AggregateID": {
                "value": "ef9c22c1-eb5c-4e08-ad5d-84f46060d563"
            }
        }
    }
}

```

Response is always the same:

```auto
{
    "took": 0,
    "timed_out": false,
    "_shards": {
        "total": 4,
        "successful": 4,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 0,
            "relation": "eq"
        },
        "max_score": null,
        "hits": []
    }
}

```

Some help will be appreciated a lot to point out what I am doing wrong.

Thanks a lot for your time and consideration guys.

---

<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:** [March 1, 2021, 9:19pm UTC](https://discuss.elastic.co/t/bool-or-term-quey-does-not-match-any-document/262908/2 "2021-03-01T21:19:52Z")

</div>

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