# Get API

**URL:** <https://discuss.elastic.co/t/get-api/4940>\
**Category:** Elasticsearch\
**Created:** [July 25, 2011, 12:15am UTC](https://discuss.elastic.co/t/get-api/4940 "2011-07-25T00:15:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajsie](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@ajsie](https://discuss.elastic.co/u/ajsie)\
**Post date:** [July 25, 2011, 12:15am UTC](https://discuss.elastic.co/t/get-api/4940/1 "2011-07-25T00:15:28Z")

</div>

Could someone explain what this is all about.

"When getting a document, one can specify fields to fetch from it.  
They will, when possible, be fetched as stored fields (fields mapped  
as stored in the mapping). When using realtime GET, there is no notion  
of stored fields (at least for a period of time, basically, until the  
next flush), so they will be extracted from the source itself (note,  
even if source is not enabled). It is a good practice to assume that  
the fields will be loaded from source when using realtime GET, even if  
the fields are stored."

Weird, but I don't get anything of it.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 25, 2011, 9:15am UTC](https://discuss.elastic.co/t/get-api/4940/2 "2011-07-25T09:15:58Z")

</div>

A type mapping can have specific mappings associated with certain fields.  
One of those mapping option is the ability to store that field in order to  
explicitly retrieve it.

But, elasticsearch, by default, stores the source document in the index (the  
json document you indexed). This is what you get by default, when you don't  
explicitly specify any fields to get back. You can specify something like  
\_source.obj1.field2 as a field to get back, and what will happen is that the  
source will be loaded, parsed, and only the obj1.field2 will be returned.

elasticsearch goes a step forward, and, if you specify obj1.field2, and that  
field is not explicitly mapped as stored, it will automatically load the  
field from \_source.

When using realtime get, the notion of stored fields is not preserved when  
the field is loaded, only the \_source is available. So, it will always go  
through the path of parsing the source and trying to get back that field is  
you explicitly specify fields to load.

On Mon, Jul 25, 2011 at 3:15 AM, ajsie [johnny.weng.luu@gmail.com](mailto:johnny.weng.luu@gmail.com) wrote:

> Could someone explain what this is all about.
> 
> "When getting a document, one can specify fields to fetch from it.  
> They will, when possible, be fetched as stored fields (fields mapped  
> as stored in the mapping). When using realtime GET, there is no notion  
> of stored fields (at least for a period of time, basically, until the  
> next flush), so they will be extracted from the source itself (note,  
> even if source is not enabled). It is a good practice to assume that  
> the fields will be loaded from source when using realtime GET, even if  
> the fields are stored."
> 
> Weird, but I don't get anything of 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:** [July 6, 2017, 3:59am UTC](https://discuss.elastic.co/t/get-api/4940/3 "2017-07-06T03:59:37Z")

</div>


