# XContent and Aggregations replacing agg names

**URL:** <https://discuss.elastic.co/t/xcontent-and-aggregations-replacing-agg-names/139246>\
**Category:** Elasticsearch\
**Created:** [July 9, 2018, 11:45pm UTC](https://discuss.elastic.co/t/xcontent-and-aggregations-replacing-agg-names/139246 "2018-07-09T23:45:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Chambers1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_chambers1/32/43254_2.png) [@Matt\_Chambers1](https://discuss.elastic.co/u/Matt_Chambers1)\
**Post date:** [July 9, 2018, 11:45pm UTC](https://discuss.elastic.co/t/xcontent-and-aggregations-replacing-agg-names/139246/1 "2018-07-09T23:45:10Z")

</div>

Hi there, kinda an obscure issue here.

So basically I'm extracting the aggs from the search result like this:

```
val json = XContentFactory.jsonBuilder().use { json ->
                    json.startObject()
                    aggregations.toXContent(json, ToXContent.EMPTY_PARAMS)
                    json.endObject()
                }.string()

```

And somehow the names of the aggregations are being replaced with like a hash tag thing. I didn't submit the agg name as filter#facet or lterms#foo

```
result : {
  "filter#facet" : {
    "doc_count" : 2,
    "lterms#foo" : {
      "doc_count_error_upper_bound" : 0,
      "sum_other_doc_count" : 0,
      "buckets" : [ {
        "key" : 1800475,
        "doc_count" : 1
      }, {
        "key" : 3153775,
        "doc_count" : 1
      } ]
    }
  }
}

```

Any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Matt\_Chambers1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_chambers1/32/43254_2.png) [@Matt\_Chambers1](https://discuss.elastic.co/u/Matt_Chambers1)\
**Post date:** [July 10, 2018, 1:06am UTC](https://discuss.elastic.co/t/xcontent-and-aggregations-replacing-agg-names/139246/2 "2018-07-10T01:06:55Z")

</div>

This is on 6.2.4 BTW.

This has something to do with typed keys, just not sure how to disable it.

---

<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:** [August 7, 2018, 1:07am UTC](https://discuss.elastic.co/t/xcontent-and-aggregations-replacing-agg-names/139246/3 "2018-08-07T01:07:09Z")

</div>

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