# Pinned Query with Term Aggregation get me null\_pointer\_exception

**URL:** <https://discuss.elastic.co/t/pinned-query-with-term-aggregation-get-me-null-pointer-exception/227932>\
**Category:** Elasticsearch\
**Created:** [April 14, 2020, 2:04pm UTC](https://discuss.elastic.co/t/pinned-query-with-term-aggregation-get-me-null-pointer-exception/227932 "2020-04-14T14:04:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dearste](https://avatars.discourse-cdn.com/v4/letter/d/85f322/32.png) [@dearste](https://discuss.elastic.co/u/dearste)\
**Post date:** [April 14, 2020, 2:04pm UTC](https://discuss.elastic.co/t/pinned-query-with-term-aggregation-get-me-null-pointer-exception/227932/1 "2020-04-14T14:04:58Z")

</div>

Hi, try this query but gives me null\_pointer\_exception:

```auto
    {
      "query": {
        "pinned": {
          "ids": [
            "1819"
          ],
          "organic": {
            "bool": {
              "must": [
                {
                  "multi_match": {
                    "query": "test",
                    "fields": [
                      "name.lowercase^5",
                      "synonim^4",
                      "sku.lowercase^3",
                      "description^1"
                    ],
                    "operator" : "and",
                    "fuzziness" : 1,
                    "analyzer": "synonym"
                   
                  }
                }
              ]
            }
          }
        }
      },
      "aggs": {
        
        "categories_without_path": {
          "terms": {
            "field": "categories_without_path",
            "size": 10
          }
        }
      },
      "suggest": {
        "suggestion": {
          "prefix": "test",
          "completion": {
            "field": "suggest",
            "size": 5
          }
        }
      }
    }

```

If i remove "aggs" ot works....can you help?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [April 14, 2020, 2:29pm UTC](https://discuss.elastic.co/t/pinned-query-with-term-aggregation-get-me-null-pointer-exception/227932/2 "2020-04-14T14:29:40Z")

</div>

> [@dearste](#):
>
> { "query": { "pinned": { "ids": ["1819"], "organic": { "bool": { "must": [{ "multi\_match": { "query": "test", "fields": ["name.lowercase^5", "synonim^4", "sku.lowercase^3", "description^1"], "operator" : "and", "fuzziness" : 1, "analyzer": "synonym" } } ] } } } }, "aggs": { "categories\_without\_path": { "terms": { "field": "categories\_without\_path", "size": 10 } } }, "suggest": { "suggestion": { "prefix": "test", "completion": { "field": "suggest", "size": 5 } } } }

This [issue](https://github.com/elastic/elasticsearch/issues/51034) will be fixed in 7.7

---

<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:** [May 12, 2020, 2:29pm UTC](https://discuss.elastic.co/t/pinned-query-with-term-aggregation-get-me-null-pointer-exception/227932/3 "2020-05-12T14:29:41Z")

</div>

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