# Indexing nested props with NEST 7.1 leads to unqueryable $ref props in indexed docs?!

**URL:** <https://discuss.elastic.co/t/indexing-nested-props-with-nest-7-1-leads-to-unqueryable-ref-props-in-indexed-docs/200071>\
**Category:** Elasticsearch\
**Created:** [September 18, 2019, 6:48pm UTC](https://discuss.elastic.co/t/indexing-nested-props-with-nest-7-1-leads-to-unqueryable-ref-props-in-indexed-docs/200071 "2019-09-18T18:48:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nielo](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@nielo](https://discuss.elastic.co/u/nielo)\
**Post date:** [September 18, 2019, 6:48pm UTC](https://discuss.elastic.co/t/indexing-nested-props-with-nest-7-1-leads-to-unqueryable-ref-props-in-indexed-docs/200071/1 "2019-09-18T18:48:41Z")

</div>

Dear team and people out there,

we just upgraded from 6.3 to 7.1 and after recreating our indices and reindexing our docs poco properties like

```
[Nest.Nested]
public Address Location
{
    get { return HasAddress ? Address : Organizer?.Organization?.Address; }
}

```

with many properties inside like "Street", "Zip", "City" and so on are being saved in index with simple

```
      "Location" : {
        "$ref" : "7165"
      },

```

Simple queries with

```
,
            {
                "bool": {
                    "must": [
                        {
                            "range": {
                                "Location.Latitude": {
                                    "gte": 0,
                                    "lte": 100
                                }
                            }
                        }
                    ]
                }
            }

```

don't work anymore.  
Does anybody have the slightest clue about what's going on here?

Thx in advance // nielo

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [September 24, 2019, 9:08pm UTC](https://discuss.elastic.co/t/indexing-nested-props-with-nest-7-1-leads-to-unqueryable-ref-props-in-indexed-docs/200071/2 "2019-09-24T21:08:53Z")

</div>

Can you provide more detail about how the client is configured and the serializer that you're using? Also, the code that was used to index documents would also help.

---

<div class="post-metadata">

**Author:** ![nielo](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@nielo](https://discuss.elastic.co/u/nielo)\
**Post date:** [September 24, 2019, 9:48pm UTC](https://discuss.elastic.co/t/indexing-nested-props-with-nest-7-1-leads-to-unqueryable-ref-props-in-indexed-docs/200071/3 "2019-09-24T21:48:17Z")

</div>

Thanks, Russ, for your interest. Meanwhile I've found the reason: JsonNetSerializer's

```
PreserveReferencesHandling = PreserveReferencesHandling.All 

```

seemed to cause this internal json referencing.

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [September 24, 2019, 10:09pm UTC](https://discuss.elastic.co/t/indexing-nested-props-with-nest-7-1-leads-to-unqueryable-ref-props-in-indexed-docs/200071/4 "2019-09-24T22:09:01Z")

</div>

My suspicion was that this is in the `JsonNetSerializer` configuration used, as [`"$ref"` is a reference property used by Json.NET](https://www.newtonsoft.com/json/help/html/PreserveObjectReferences.htm).

---

<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:** [October 22, 2019, 10:18pm UTC](https://discuss.elastic.co/t/indexing-nested-props-with-nest-7-1-leads-to-unqueryable-ref-props-in-indexed-docs/200071/5 "2019-10-22T22:18:04Z")

</div>

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