# Can't get nested fields with stored\_fields

**URL:** <https://discuss.elastic.co/t/cant-get-nested-fields-with-stored-fields/65358>\
**Category:** Elasticsearch\
**Created:** [November 8, 2016, 1:52pm UTC](https://discuss.elastic.co/t/cant-get-nested-fields-with-stored-fields/65358 "2016-11-08T13:52:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zeropitarr](https://avatars.discourse-cdn.com/v4/letter/z/da6949/32.png) [@Zeropitarr](https://discuss.elastic.co/u/Zeropitarr)\
**Post date:** [November 8, 2016, 1:52pm UTC](https://discuss.elastic.co/t/cant-get-nested-fields-with-stored-fields/65358/1 "2016-11-08T13:52:24Z")

</div>

All. I'm using ElasticSearch 5.0 and I have next mapping:

```
{
    "mappings": {
        "object":{
            "properties":{
                "attributes":{
                    "type":"nested",
                    "properties":{
                        "name": { "type": "keyword", "store":true},
                        "value": { "type": "text", "store":true },
                        "converted": {"type": "double", "store":true},
                        "datetimestamp": { "type": "date", "store":true}
                    }
                }
            }
        }
    }
}

```

Then I add one document:

```
{
    "attributes":[
        {"name":"attribute_string", "value":"string_value","converted":null,"datetimestamp":null},
        {"name":"attribute_double", "value":"1234.567","converted":1234.567,"datetimestamp":null},
        {"name":"attribute_datetime", "value":"2015-01-01T12:10:30Z","converted":null,"datetimestamp":"2015-01-01T12:10:30Z"}
        ]    
}

```

When I query w/ "stored\_fields", I don't have fields in results:

```
_search
{
    "stored_fields":["attributes.converted"]
}

```

Results:

```
{
    "_index": "test_index",
    "_type": "object",
    "_id": "1",
    "_score": 1
 }

```

But when I use "\_source":["attributes.converted"] , i have result:

```
 {
    "_index": "test_index",
    "_type": "object",
    "_id": "1",
    "_score": 1,
    "_source": {
       "attributes": [
          { "converted": null },
          { "converted": 1234.567 },
          { "converted": null }
       ]
    }
 }

```

What is the proper way to use stored\_fields? Does usage of "\_source" affect performance compare to "stored\_fields" approach?

If "\_source" approach is fast as "stored\_fields", shall I remove "store":true for the fields?

Thank you.

---

<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:** [December 6, 2016, 1:52pm UTC](https://discuss.elastic.co/t/cant-get-nested-fields-with-stored-fields/65358/2 "2016-12-06T13:52:28Z")

</div>

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