# Error while retrieving an object field

**URL:** <https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279>\
**Category:** Elasticsearch\
**Created:** [August 31, 2010, 7:22am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279 "2010-08-31T07:22:42Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahendra\_M](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahendra_m/32/3128_2.png) [@Mahendra\_M](https://discuss.elastic.co/u/Mahendra_M)\
**Post date:** [August 31, 2010, 7:22am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/1 "2010-08-31T07:22:42Z")

</div>

Hi,

In the documents that I index, I have a field of 'object' type.  
Mapped as follows.

```
  "price" : {
    "type" : "object",
    "dynamic" : true,
    "enabled" : true,
    "store" : true,
    "include_in_all": false
  },

```

The documents will have different keys for this as follows. These may  
be fixed or varying.  
'price' : {  
'us' : 1.0,  
'uk' : 2.0  
}

My requirement, is that while querying, I need the price field as-is  
by specifying  
the "fields" option. In this example, I give -  
fields=price

However, I get the error:  
reason: "FetchPhaseExecutionException[[index\_name][0]:  
query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping for field  
[price]]]

Is it possible to retrieve an object, in the JSON format as is ? Or am  
I doing it incorrectly ?

I do not want to retrieve the entire '\_source' for getting just the  
"price" fields within it.

Regards,  
Mahendra

[http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<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:** [August 31, 2010, 8:18am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/2 "2010-08-31T08:18:49Z")

</div>

Its not possible currently. There is a feature request to allow to return  
parts of the \_source json (as well as use it for highlighting).

-shay.bnaon

On Tue, Aug 31, 2010 at 10:22 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:

> Hi,
> 
> In the documents that I index, I have a field of 'object' type.  
> Mapped as follows.
> 
> ```
> "price" : {
> "type" : "object",
> "dynamic" : true,
> "enabled" : true,
> "store" : true,
> "include_in_all": false
> },
> 
> ```
> 
> The documents will have different keys for this as follows. These may  
> be fixed or varying.  
> 'price' : {  
> 'us' : 1.0,  
> 'uk' : 2.0  
> }
> 
> My requirement, is that while querying, I need the price field as-is  
> by specifying  
> the "fields" option. In this example, I give -  
> fields=price
> 
> However, I get the error:  
> reason: "FetchPhaseExecutionException[[index\_name][0]:  
> query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping for field  
> [price]]]
> 
> Is it possible to retrieve an object, in the JSON format as is ? Or am  
> I doing it incorrectly ?
> 
> I do not want to retrieve the entire '\_source' for getting just the  
> "price" fields within it.
> 
> Regards,  
> Mahendra
> 
> [http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<div class="post-metadata">

**Author:** ![Mahendra\_M](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahendra_m/32/3128_2.png) [@Mahendra\_M](https://discuss.elastic.co/u/Mahendra_M)\
**Post date:** [September 3, 2010, 7:28am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/3 "2010-09-03T07:28:39Z")

</div>

Hi,

I guess the latest commit (349) adds this feature. Thanks a lot 🙂

I have one doubt regarding the "script\_fields" option. I guess it is  
not available through the URI request method.

Also is it possible to obtain the object via the "fields" option ?  
By specifying

fields=...,...,doc.price OR  
fields=...,...,\_source.price

Regards,  
Mahendra

[http://twitter.com/mahendra](http://twitter.com/mahendra)

On Tue, Aug 31, 2010 at 1:48 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> Its not possible currently. There is a feature request to allow to return  
> parts of the \_source json (as well as use it for highlighting).  
> -shay.bnaon
> 
> On Tue, Aug 31, 2010 at 10:22 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:
> 
> > Hi,
> > 
> > In the documents that I index, I have a field of 'object' type.  
> > Mapped as follows.
> > 
> > ```
> > "price" : {
> > "type" : "object",
> > "dynamic" : true,
> > "enabled" : true,
> > "store" : true,
> > "include_in_all": false
> > },
> > 
> > ```
> > 
> > The documents will have different keys for this as follows. These may  
> > be fixed or varying.  
> > 'price' : {  
> > 'us' : 1.0,  
> > 'uk' : 2.0  
> > }
> > 
> > My requirement, is that while querying, I need the price field as-is  
> > by specifying  
> > the "fields" option. In this example, I give -  
> > fields=price
> > 
> > However, I get the error:  
> > reason: "FetchPhaseExecutionException[[index\_name][0]:  
> > query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping for field  
> > [price]]]
> > 
> > Is it possible to retrieve an object, in the JSON format as is ? Or am  
> > I doing it incorrectly ?
> > 
> > I do not want to retrieve the entire '\_source' for getting just the  
> > "price" fields within it.
> > 
> > Regards,  
> > Mahendra
> > 
> > [http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<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:** [September 3, 2010, 8:32am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/4 "2010-09-03T08:32:42Z")

</div>

No, only through the script fields. What are you missing, the option to  
provide script fields in the URI of a GET request.

On Fri, Sep 3, 2010 at 10:28 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:

> Hi,
> 
> I guess the latest commit (349) adds this feature. Thanks a lot 🙂
> 
> I have one doubt regarding the "script\_fields" option. I guess it is  
> not available through the URI request method.
> 
> Also is it possible to obtain the object via the "fields" option ?  
> By specifying
> 
> fields=...,...,doc.price OR  
> fields=...,...,\_source.price
> 
> Regards,  
> Mahendra
> 
> [http://twitter.com/mahendra](http://twitter.com/mahendra)
> 
> On Tue, Aug 31, 2010 at 1:48 PM, Shay Banon  
> [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > Its not possible currently. There is a feature request to allow to return  
> > parts of the \_source json (as well as use it for highlighting).  
> > -shay.bnaon
> > 
> > On Tue, Aug 31, 2010 at 10:22 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > wrote:
> > 
> > > Hi,
> > > 
> > > In the documents that I index, I have a field of 'object' type.  
> > > Mapped as follows.
> > > 
> > > ```
> > > "price" : {
> > > "type" : "object",
> > > "dynamic" : true,
> > > "enabled" : true,
> > > "store" : true,
> > > "include_in_all": false
> > > },
> > > 
> > > ```
> > > 
> > > The documents will have different keys for this as follows. These may  
> > > be fixed or varying.  
> > > 'price' : {  
> > > 'us' : 1.0,  
> > > 'uk' : 2.0  
> > > }
> > > 
> > > My requirement, is that while querying, I need the price field as-is  
> > > by specifying  
> > > the "fields" option. In this example, I give -  
> > > fields=price
> > > 
> > > However, I get the error:  
> > > reason: "FetchPhaseExecutionException[[index\_name][0]:  
> > > query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping for field  
> > > [price]]]
> > > 
> > > Is it possible to retrieve an object, in the JSON format as is ? Or am  
> > > I doing it incorrectly ?
> > > 
> > > I do not want to retrieve the entire '\_source' for getting just the  
> > > "price" fields within it.
> > > 
> > > Regards,  
> > > Mahendra
> > > 
> > > [http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<div class="post-metadata">

**Author:** ![Mahendra\_M](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahendra_m/32/3128_2.png) [@Mahendra\_M](https://discuss.elastic.co/u/Mahendra_M)\
**Post date:** [September 5, 2010, 6:27am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/5 "2010-09-05T06:27:32Z")

</div>

Hi,

Currently, my Elasticsearch setup is accessed through GET requests.  
The returned fields are specified through the "fields" option in the  
GET URI.

It would be good if I can specify the object field also in the GET  
request and return the JSON format of the object field.

Alternately, I can make use of providing the script fields in the URI  
of a GET request, if it is possible.

Regards,  
Mahendra

[http://twitter.com/mahendra](http://twitter.com/mahendra)

On Fri, Sep 3, 2010 at 2:02 PM, Shay Banon wrote:

> No, only through the script fields. What are you missing, the option to provide script fields in the URI of a GET request.
> 
> On Fri, Sep 3, 2010 at 10:28 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:
> 
> > Hi,
> > 
> > I guess the latest commit (349) adds this feature. Thanks a lot 🙂
> > 
> > I have one doubt regarding the "script\_fields" option. I guess it is  
> > not available through the URI request method.
> > 
> > Also is it possible to obtain the object via the "fields" option ?  
> > By specifying
> > 
> > fields=...,...,doc.price OR  
> > fields=...,...,\_source.price
> > 
> > Regards,  
> > Mahendra
> > 
> > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > 
> > On Tue, Aug 31, 2010 at 1:48 PM, Shay Banon  
> > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > 
> > > Its not possible currently. There is a feature request to allow to return  
> > > parts of the \_source json (as well as use it for highlighting).  
> > > -shay.bnaon
> > > 
> > > On Tue, Aug 31, 2010 at 10:22 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:
> > > 
> > > > Hi,
> > > > 
> > > > In the documents that I index, I have a field of 'object' type.  
> > > > Mapped as follows.
> > > > 
> > > > ```
> > > > "price" : {
> > > > "type" : "object",
> > > > "dynamic" : true,
> > > > "enabled" : true,
> > > > "store" : true,
> > > > "include_in_all": false
> > > > },
> > > > 
> > > > ```
> > > > 
> > > > The documents will have different keys for this as follows. These may  
> > > > be fixed or varying.  
> > > > 'price' : {  
> > > > 'us' : 1.0,  
> > > > 'uk' : 2.0  
> > > > }
> > > > 
> > > > My requirement, is that while querying, I need the price field as-is  
> > > > by specifying  
> > > > the "fields" option. In this example, I give -  
> > > > fields=price
> > > > 
> > > > However, I get the error:  
> > > > reason: "FetchPhaseExecutionException[[index\_name][0]:  
> > > > query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping for field  
> > > > [price]]]
> > > > 
> > > > Is it possible to retrieve an object, in the JSON format as is ? Or am  
> > > > I doing it incorrectly ?
> > > > 
> > > > I do not want to retrieve the entire '\_source' for getting just the  
> > > > "price" fields within it.
> > > > 
> > > > Regards,  
> > > > Mahendra
> > > > 
> > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<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:** [September 5, 2010, 7:27am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/6 "2010-09-05T07:27:13Z")

</div>

Open an issue request, they can be added to the URI option as well. I think  
that you are missing a lot of functionality by just using the search with  
URI option. There shouldn't really be a problem providing a body in the  
search request, no?

On Sun, Sep 5, 2010 at 9:27 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:

> Hi,
> 
> Currently, my Elasticsearch setup is accessed through GET requests.  
> The returned fields are specified through the "fields" option in the  
> GET URI.
> 
> It would be good if I can specify the object field also in the GET  
> request and return the JSON format of the object field.
> 
> Alternately, I can make use of providing the script fields in the URI  
> of a GET request, if it is possible.
> 
> Regards,  
> Mahendra
> 
> [http://twitter.com/mahendra](http://twitter.com/mahendra)
> 
> On Fri, Sep 3, 2010 at 2:02 PM, Shay Banon wrote:
> 
> > No, only through the script fields. What are you missing, the option to  
> > provide script fields in the URI of a GET request.
> > 
> > On Fri, Sep 3, 2010 at 10:28 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > wrote:
> > 
> > > Hi,
> > > 
> > > I guess the latest commit (349) adds this feature. Thanks a lot 🙂
> > > 
> > > I have one doubt regarding the "script\_fields" option. I guess it is  
> > > not available through the URI request method.
> > > 
> > > Also is it possible to obtain the object via the "fields" option ?  
> > > By specifying
> > > 
> > > fields=...,...,doc.price OR  
> > > fields=...,...,\_source.price
> > > 
> > > Regards,  
> > > Mahendra
> > > 
> > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > 
> > > On Tue, Aug 31, 2010 at 1:48 PM, Shay Banon  
> > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > 
> > > > Its not possible currently. There is a feature request to allow to  
> > > > return  
> > > > parts of the \_source json (as well as use it for highlighting).  
> > > > -shay.bnaon
> > > > 
> > > > On Tue, Aug 31, 2010 at 10:22 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > In the documents that I index, I have a field of 'object' type.  
> > > > > Mapped as follows.
> > > > > 
> > > > > ```
> > > > > "price" : {
> > > > > "type" : "object",
> > > > > "dynamic" : true,
> > > > > "enabled" : true,
> > > > > "store" : true,
> > > > > "include_in_all": false
> > > > > },
> > > > > 
> > > > > ```
> > > > > 
> > > > > The documents will have different keys for this as follows. These may  
> > > > > be fixed or varying.  
> > > > > 'price' : {  
> > > > > 'us' : 1.0,  
> > > > > 'uk' : 2.0  
> > > > > }
> > > > > 
> > > > > My requirement, is that while querying, I need the price field as-is  
> > > > > by specifying  
> > > > > the "fields" option. In this example, I give -  
> > > > > fields=price
> > > > > 
> > > > > However, I get the error:  
> > > > > reason: "FetchPhaseExecutionException[[index\_name][0]:  
> > > > > query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping for field  
> > > > > [price]]]
> > > > > 
> > > > > Is it possible to retrieve an object, in the JSON format as is ? Or  
> > > > > am  
> > > > > I doing it incorrectly ?
> > > > > 
> > > > > I do not want to retrieve the entire '\_source' for getting just the  
> > > > > "price" fields within it.
> > > > > 
> > > > > Regards,  
> > > > > Mahendra
> > > > > 
> > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<div class="post-metadata">

**Author:** ![Mahendra\_M](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahendra_m/32/3128_2.png) [@Mahendra\_M](https://discuss.elastic.co/u/Mahendra_M)\
**Post date:** [September 6, 2010, 4:48am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/7 "2010-09-06T04:48:47Z")

</div>

Hi,

I have opened an issue request for this (#357).

Yes, I know that I am missing on quite a lot of functionality by using  
just the URI option, but this is used in clients which have very  
limited resources. The more powerful clients use the query API.

I have exposed the URI to very tiny embedded devices which need to  
query Elasticsearch. The search URI is a simple option for them.

Another reason is, by using the "fields" API, the output of  
Elasticsearch can be made very similar to the output of couchdb views.  
So, clients accessing couchdb and elasticsearch can have the same  
format for accessing data.

Regards,  
Mahendra

[http://twitter.com/mahendra](http://twitter.com/mahendra)

On Sun, Sep 5, 2010 at 12:57 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> Open an issue request, they can be added to the URI option as well. I think  
> that you are missing a lot of functionality by just using the search with  
> URI option. There shouldn't really be a problem providing a body in the  
> search request, no?
> 
> On Sun, Sep 5, 2010 at 9:27 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:
> 
> > Hi,
> > 
> > Currently, my Elasticsearch setup is accessed through GET requests.  
> > The returned fields are specified through the "fields" option in the  
> > GET URI.
> > 
> > It would be good if I can specify the object field also in the GET  
> > request and return the JSON format of the object field.
> > 
> > Alternately, I can make use of providing the script fields in the URI  
> > of a GET request, if it is possible.
> > 
> > Regards,  
> > Mahendra
> > 
> > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > 
> > On Fri, Sep 3, 2010 at 2:02 PM, Shay Banon wrote:
> > 
> > > No, only through the script fields. What are you missing, the option to  
> > > provide script fields in the URI of a GET request.
> > > 
> > > On Fri, Sep 3, 2010 at 10:28 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > wrote:
> > > 
> > > > Hi,
> > > > 
> > > > I guess the latest commit (349) adds this feature. Thanks a lot 🙂
> > > > 
> > > > I have one doubt regarding the "script\_fields" option. I guess it is  
> > > > not available through the URI request method.
> > > > 
> > > > Also is it possible to obtain the object via the "fields" option ?  
> > > > By specifying
> > > > 
> > > > fields=...,...,doc.price OR  
> > > > fields=...,...,\_source.price
> > > > 
> > > > Regards,  
> > > > Mahendra
> > > > 
> > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > 
> > > > On Tue, Aug 31, 2010 at 1:48 PM, Shay Banon  
> > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > 
> > > > > Its not possible currently. There is a feature request to allow to  
> > > > > return  
> > > > > parts of the \_source json (as well as use it for highlighting).  
> > > > > -shay.bnaon
> > > > > 
> > > > > On Tue, Aug 31, 2010 at 10:22 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > In the documents that I index, I have a field of 'object' type.  
> > > > > > Mapped as follows.
> > > > > > 
> > > > > > ```
> > > > > > "price" : {
> > > > > > "type" : "object",
> > > > > > "dynamic" : true,
> > > > > > "enabled" : true,
> > > > > > "store" : true,
> > > > > > "include_in_all": false
> > > > > > },
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > The documents will have different keys for this as follows. These  
> > > > > > may  
> > > > > > be fixed or varying.  
> > > > > > 'price' : {  
> > > > > > 'us' : 1.0,  
> > > > > > 'uk' : 2.0  
> > > > > > }
> > > > > > 
> > > > > > My requirement, is that while querying, I need the price field as-is  
> > > > > > by specifying  
> > > > > > the "fields" option. In this example, I give -  
> > > > > > fields=price
> > > > > > 
> > > > > > However, I get the error:  
> > > > > > reason: "FetchPhaseExecutionException[[index\_name][0]:  
> > > > > > query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping for field  
> > > > > > [price]]]
> > > > > > 
> > > > > > Is it possible to retrieve an object, in the JSON format as is ? Or  
> > > > > > am  
> > > > > > I doing it incorrectly ?
> > > > > > 
> > > > > > I do not want to retrieve the entire '\_source' for getting just the  
> > > > > > "price" fields within it.
> > > > > > 
> > > > > > Regards,  
> > > > > > Mahendra
> > > > > > 
> > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<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:** [September 6, 2010, 7:01am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/8 "2010-09-06T07:01:22Z")

</div>

The problem with using fields is that I can't tell between ones that try and  
fetch a stored field, compared to script fields that will result in getting  
the source... .

-shay.banon

On Mon, Sep 6, 2010 at 7:48 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:

> Hi,
> 
> I have opened an issue request for this (#357).
> 
> Yes, I know that I am missing on quite a lot of functionality by using  
> just the URI option, but this is used in clients which have very  
> limited resources. The more powerful clients use the query API.
> 
> I have exposed the URI to very tiny embedded devices which need to  
> query Elasticsearch. The search URI is a simple option for them.
> 
> Another reason is, by using the "fields" API, the output of  
> Elasticsearch can be made very similar to the output of couchdb views.  
> So, clients accessing couchdb and elasticsearch can have the same  
> format for accessing data.
> 
> Regards,  
> Mahendra
> 
> [http://twitter.com/mahendra](http://twitter.com/mahendra)
> 
> On Sun, Sep 5, 2010 at 12:57 PM, Shay Banon  
> [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > Open an issue request, they can be added to the URI option as well. I  
> > think  
> > that you are missing a lot of functionality by just using the search with  
> > URI option. There shouldn't really be a problem providing a body in the  
> > search request, no?
> > 
> > On Sun, Sep 5, 2010 at 9:27 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:
> > 
> > > Hi,
> > > 
> > > Currently, my Elasticsearch setup is accessed through GET requests.  
> > > The returned fields are specified through the "fields" option in the  
> > > GET URI.
> > > 
> > > It would be good if I can specify the object field also in the GET  
> > > request and return the JSON format of the object field.
> > > 
> > > Alternately, I can make use of providing the script fields in the URI  
> > > of a GET request, if it is possible.
> > > 
> > > Regards,  
> > > Mahendra
> > > 
> > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > 
> > > On Fri, Sep 3, 2010 at 2:02 PM, Shay Banon wrote:
> > > 
> > > > No, only through the script fields. What are you missing, the option  
> > > > to  
> > > > provide script fields in the URI of a GET request.
> > > > 
> > > > On Fri, Sep 3, 2010 at 10:28 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > I guess the latest commit (349) adds this feature. Thanks a lot 🙂
> > > > > 
> > > > > I have one doubt regarding the "script\_fields" option. I guess it is  
> > > > > not available through the URI request method.
> > > > > 
> > > > > Also is it possible to obtain the object via the "fields" option ?  
> > > > > By specifying
> > > > > 
> > > > > fields=...,...,doc.price OR  
> > > > > fields=...,...,\_source.price
> > > > > 
> > > > > Regards,  
> > > > > Mahendra
> > > > > 
> > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > > 
> > > > > On Tue, Aug 31, 2010 at 1:48 PM, Shay Banon  
> > > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > > 
> > > > > > Its not possible currently. There is a feature request to allow to  
> > > > > > return  
> > > > > > parts of the \_source json (as well as use it for highlighting).  
> > > > > > -shay.bnaon
> > > > > > 
> > > > > > On Tue, Aug 31, 2010 at 10:22 AM, Mahendra M \<[mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)
> > 
> > > > > > wrote:
> > > > > > 
> > > > > > > Hi,
> > > > > > > 
> > > > > > > In the documents that I index, I have a field of 'object' type.  
> > > > > > > Mapped as follows.
> > > > > > > 
> > > > > > > ```
> > > > > > > "price" : {
> > > > > > > "type" : "object",
> > > > > > > "dynamic" : true,
> > > > > > > "enabled" : true,
> > > > > > > "store" : true,
> > > > > > > "include_in_all": false
> > > > > > > },
> > > > > > > 
> > > > > > > ```
> > > > > > > 
> > > > > > > The documents will have different keys for this as follows. These  
> > > > > > > may  
> > > > > > > be fixed or varying.  
> > > > > > > 'price' : {  
> > > > > > > 'us' : 1.0,  
> > > > > > > 'uk' : 2.0  
> > > > > > > }
> > > > > > > 
> > > > > > > My requirement, is that while querying, I need the price field  
> > > > > > > as-is  
> > > > > > > by specifying  
> > > > > > > the "fields" option. In this example, I give -  
> > > > > > > fields=price
> > > > > > > 
> > > > > > > However, I get the error:  
> > > > > > > reason: "FetchPhaseExecutionException[[index\_name][0]:  
> > > > > > > query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping for  
> > > > > > > field  
> > > > > > > [price]]]
> > > > > > > 
> > > > > > > Is it possible to retrieve an object, in the JSON format as is ?  
> > > > > > > Or  
> > > > > > > am  
> > > > > > > I doing it incorrectly ?
> > > > > > > 
> > > > > > > I do not want to retrieve the entire '\_source' for getting just  
> > > > > > > the  
> > > > > > > "price" fields within it.
> > > > > > > 
> > > > > > > Regards,  
> > > > > > > Mahendra
> > > > > > > 
> > > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<div class="post-metadata">

**Author:** ![Mahendra\_M](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahendra_m/32/3128_2.png) [@Mahendra\_M](https://discuss.elastic.co/u/Mahendra_M)\
**Post date:** [September 6, 2010, 7:13am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/9 "2010-09-06T07:13:49Z")

</div>

Hmmm, i understand the problem.

In that case, would it be possible to use script fields in the search URI ?

Regards,  
Mahendra

[http://twitter.com/mahendra](http://twitter.com/mahendra)

On Mon, Sep 6, 2010 at 12:31 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> The problem with using fields is that I can't tell between ones that try and  
> fetch a stored field, compared to script fields that will result in getting  
> the source... .  
> -shay.banon
> 
> On Mon, Sep 6, 2010 at 7:48 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:
> 
> > Hi,
> > 
> > I have opened an issue request for this (#357).
> > 
> > Yes, I know that I am missing on quite a lot of functionality by using  
> > just the URI option, but this is used in clients which have very  
> > limited resources. The more powerful clients use the query API.
> > 
> > I have exposed the URI to very tiny embedded devices which need to  
> > query Elasticsearch. The search URI is a simple option for them.
> > 
> > Another reason is, by using the "fields" API, the output of  
> > Elasticsearch can be made very similar to the output of couchdb views.  
> > So, clients accessing couchdb and elasticsearch can have the same  
> > format for accessing data.
> > 
> > Regards,  
> > Mahendra
> > 
> > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > 
> > On Sun, Sep 5, 2010 at 12:57 PM, Shay Banon  
> > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > 
> > > Open an issue request, they can be added to the URI option as well. I  
> > > think  
> > > that you are missing a lot of functionality by just using the search  
> > > with  
> > > URI option. There shouldn't really be a problem providing a body in the  
> > > search request, no?
> > > 
> > > On Sun, Sep 5, 2010 at 9:27 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:
> > > 
> > > > Hi,
> > > > 
> > > > Currently, my Elasticsearch setup is accessed through GET requests.  
> > > > The returned fields are specified through the "fields" option in the  
> > > > GET URI.
> > > > 
> > > > It would be good if I can specify the object field also in the GET  
> > > > request and return the JSON format of the object field.
> > > > 
> > > > Alternately, I can make use of providing the script fields in the URI  
> > > > of a GET request, if it is possible.
> > > > 
> > > > Regards,  
> > > > Mahendra
> > > > 
> > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > 
> > > > On Fri, Sep 3, 2010 at 2:02 PM, Shay Banon wrote:
> > > > 
> > > > > No, only through the script fields. What are you missing, the option  
> > > > > to  
> > > > > provide script fields in the URI of a GET request.
> > > > > 
> > > > > On Fri, Sep 3, 2010 at 10:28 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > I guess the latest commit (349) adds this feature. Thanks a lot 🙂
> > > > > > 
> > > > > > I have one doubt regarding the "script\_fields" option. I guess it is  
> > > > > > not available through the URI request method.
> > > > > > 
> > > > > > Also is it possible to obtain the object via the "fields" option ?  
> > > > > > By specifying
> > > > > > 
> > > > > > fields=...,...,doc.price OR  
> > > > > > fields=...,...,\_source.price
> > > > > > 
> > > > > > Regards,  
> > > > > > Mahendra
> > > > > > 
> > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > > > 
> > > > > > On Tue, Aug 31, 2010 at 1:48 PM, Shay Banon  
> > > > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > > > 
> > > > > > > Its not possible currently. There is a feature request to allow to  
> > > > > > > return  
> > > > > > > parts of the \_source json (as well as use it for highlighting).  
> > > > > > > -shay.bnaon
> > > > > > > 
> > > > > > > On Tue, Aug 31, 2010 at 10:22 AM, Mahendra M  
> > > > > > > [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > > > wrote:
> > > > > > > 
> > > > > > > > Hi,
> > > > > > > > 
> > > > > > > > In the documents that I index, I have a field of 'object' type.  
> > > > > > > > Mapped as follows.
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > "price" : {
> > > > > > > > "type" : "object",
> > > > > > > > "dynamic" : true,
> > > > > > > > "enabled" : true,
> > > > > > > > "store" : true,
> > > > > > > > "include_in_all": false
> > > > > > > > },
> > > > > > > > 
> > > > > > > > ```
> > > > > > > > 
> > > > > > > > The documents will have different keys for this as follows. These  
> > > > > > > > may  
> > > > > > > > be fixed or varying.  
> > > > > > > > 'price' : {  
> > > > > > > > 'us' : 1.0,  
> > > > > > > > 'uk' : 2.0  
> > > > > > > > }
> > > > > > > > 
> > > > > > > > My requirement, is that while querying, I need the price field  
> > > > > > > > as-is  
> > > > > > > > by specifying  
> > > > > > > > the "fields" option. In this example, I give -  
> > > > > > > > fields=price
> > > > > > > > 
> > > > > > > > However, I get the error:  
> > > > > > > > reason: "FetchPhaseExecutionException[[index\_name][0]:  
> > > > > > > > query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping for  
> > > > > > > > field  
> > > > > > > > [price]]]
> > > > > > > > 
> > > > > > > > Is it possible to retrieve an object, in the JSON format as is ?  
> > > > > > > > Or  
> > > > > > > > am  
> > > > > > > > I doing it incorrectly ?
> > > > > > > > 
> > > > > > > > I do not want to retrieve the entire '\_source' for getting just  
> > > > > > > > the  
> > > > > > > > "price" fields within it.
> > > > > > > > 
> > > > > > > > Regards,  
> > > > > > > > Mahendra
> > > > > > > > 
> > > > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<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:** [September 6, 2010, 7:15am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/10 "2010-09-06T07:15:00Z")

</div>

Yea, sure, I will come up with a schema for this.

On Mon, Sep 6, 2010 at 10:13 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:

> Hmmm, i understand the problem.
> 
> In that case, would it be possible to use script fields in the search URI ?
> 
> Regards,  
> Mahendra
> 
> [http://twitter.com/mahendra](http://twitter.com/mahendra)
> 
> On Mon, Sep 6, 2010 at 12:31 PM, Shay Banon  
> [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > The problem with using fields is that I can't tell between ones that try  
> > and  
> > fetch a stored field, compared to script fields that will result in  
> > getting  
> > the source... .  
> > -shay.banon
> > 
> > On Mon, Sep 6, 2010 at 7:48 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:
> > 
> > > Hi,
> > > 
> > > I have opened an issue request for this (#357).
> > > 
> > > Yes, I know that I am missing on quite a lot of functionality by using  
> > > just the URI option, but this is used in clients which have very  
> > > limited resources. The more powerful clients use the query API.
> > > 
> > > I have exposed the URI to very tiny embedded devices which need to  
> > > query Elasticsearch. The search URI is a simple option for them.
> > > 
> > > Another reason is, by using the "fields" API, the output of  
> > > Elasticsearch can be made very similar to the output of couchdb views.  
> > > So, clients accessing couchdb and elasticsearch can have the same  
> > > format for accessing data.
> > > 
> > > Regards,  
> > > Mahendra
> > > 
> > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > 
> > > On Sun, Sep 5, 2010 at 12:57 PM, Shay Banon  
> > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > 
> > > > Open an issue request, they can be added to the URI option as well. I  
> > > > think  
> > > > that you are missing a lot of functionality by just using the search  
> > > > with  
> > > > URI option. There shouldn't really be a problem providing a body in  
> > > > the  
> > > > search request, no?
> > > > 
> > > > On Sun, Sep 5, 2010 at 9:27 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > Currently, my Elasticsearch setup is accessed through GET requests.  
> > > > > The returned fields are specified through the "fields" option in the  
> > > > > GET URI.
> > > > > 
> > > > > It would be good if I can specify the object field also in the GET  
> > > > > request and return the JSON format of the object field.
> > > > > 
> > > > > Alternately, I can make use of providing the script fields in the URI  
> > > > > of a GET request, if it is possible.
> > > > > 
> > > > > Regards,  
> > > > > Mahendra
> > > > > 
> > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > > 
> > > > > On Fri, Sep 3, 2010 at 2:02 PM, Shay Banon wrote:
> > > > > 
> > > > > > No, only through the script fields. What are you missing, the  
> > > > > > option  
> > > > > > to  
> > > > > > provide script fields in the URI of a GET request.
> > > > > > 
> > > > > > On Fri, Sep 3, 2010 at 10:28 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > > wrote:
> > > > > > 
> > > > > > > Hi,
> > > > > > > 
> > > > > > > I guess the latest commit (349) adds this feature. Thanks a lot  
> > > > > > > 🙂
> > > > > > > 
> > > > > > > I have one doubt regarding the "script\_fields" option. I guess it  
> > > > > > > is  
> > > > > > > not available through the URI request method.
> > > > > > > 
> > > > > > > Also is it possible to obtain the object via the "fields" option ?  
> > > > > > > By specifying
> > > > > > > 
> > > > > > > fields=...,...,doc.price OR  
> > > > > > > fields=...,...,\_source.price
> > > > > > > 
> > > > > > > Regards,  
> > > > > > > Mahendra
> > > > > > > 
> > > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > > > > 
> > > > > > > On Tue, Aug 31, 2010 at 1:48 PM, Shay Banon  
> > > > > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > > > > 
> > > > > > > > Its not possible currently. There is a feature request to allow  
> > > > > > > > to  
> > > > > > > > return  
> > > > > > > > parts of the \_source json (as well as use it for highlighting).  
> > > > > > > > -shay.bnaon
> > > > > > > > 
> > > > > > > > On Tue, Aug 31, 2010 at 10:22 AM, Mahendra M  
> > > > > > > > [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > > > > wrote:
> > > > > > > > 
> > > > > > > > > Hi,
> > > > > > > > > 
> > > > > > > > > In the documents that I index, I have a field of 'object' type.  
> > > > > > > > > Mapped as follows.
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > "price" : {
> > > > > > > > > "type" : "object",
> > > > > > > > > "dynamic" : true,
> > > > > > > > > "enabled" : true,
> > > > > > > > > "store" : true,
> > > > > > > > > "include_in_all": false
> > > > > > > > > },
> > > > > > > > > 
> > > > > > > > > ```
> > > > > > > > > 
> > > > > > > > > The documents will have different keys for this as follows.  
> > > > > > > > > These  
> > > > > > > > > may  
> > > > > > > > > be fixed or varying.  
> > > > > > > > > 'price' : {  
> > > > > > > > > 'us' : 1.0,  
> > > > > > > > > 'uk' : 2.0  
> > > > > > > > > }
> > > > > > > > > 
> > > > > > > > > My requirement, is that while querying, I need the price field  
> > > > > > > > > as-is  
> > > > > > > > > by specifying  
> > > > > > > > > the "fields" option. In this example, I give -  
> > > > > > > > > fields=price
> > > > > > > > > 
> > > > > > > > > However, I get the error:  
> > > > > > > > > reason: "FetchPhaseExecutionException[[index\_name][0]:  
> > > > > > > > > query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping for  
> > > > > > > > > field  
> > > > > > > > > [price]]]
> > > > > > > > > 
> > > > > > > > > Is it possible to retrieve an object, in the JSON format as is  
> > > > > > > > > ?  
> > > > > > > > > Or  
> > > > > > > > > am  
> > > > > > > > > I doing it incorrectly ?
> > > > > > > > > 
> > > > > > > > > I do not want to retrieve the entire '\_source' for getting just  
> > > > > > > > > the  
> > > > > > > > > "price" fields within it.
> > > > > > > > > 
> > > > > > > > > Regards,  
> > > > > > > > > Mahendra
> > > > > > > > > 
> > > > > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<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:** [September 6, 2010, 8:38am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/11 "2010-09-06T08:38:59Z")

</div>

ok, was wrong about not being able to identify it, it actually can be  
identified quite simply. Revised your issue you opened to this:  
[Search API: Automatically identify "script" fields on the field elements in search · Issue #357 · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/issue/357). Have  
something already running locally, will push later today.

On Mon, Sep 6, 2010 at 10:15 AM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Yea, sure, I will come up with a schema for this.
> 
> On Mon, Sep 6, 2010 at 10:13 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:
> 
> > Hmmm, i understand the problem.
> > 
> > In that case, would it be possible to use script fields in the search URI  
> > ?
> > 
> > Regards,  
> > Mahendra
> > 
> > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > 
> > On Mon, Sep 6, 2010 at 12:31 PM, Shay Banon  
> > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > 
> > > The problem with using fields is that I can't tell between ones that try  
> > > and  
> > > fetch a stored field, compared to script fields that will result in  
> > > getting  
> > > the source... .  
> > > -shay.banon
> > > 
> > > On Mon, Sep 6, 2010 at 7:48 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > wrote:
> > > 
> > > > Hi,
> > > > 
> > > > I have opened an issue request for this (#357).
> > > > 
> > > > Yes, I know that I am missing on quite a lot of functionality by using  
> > > > just the URI option, but this is used in clients which have very  
> > > > limited resources. The more powerful clients use the query API.
> > > > 
> > > > I have exposed the URI to very tiny embedded devices which need to  
> > > > query Elasticsearch. The search URI is a simple option for them.
> > > > 
> > > > Another reason is, by using the "fields" API, the output of  
> > > > Elasticsearch can be made very similar to the output of couchdb views.  
> > > > So, clients accessing couchdb and elasticsearch can have the same  
> > > > format for accessing data.
> > > > 
> > > > Regards,  
> > > > Mahendra
> > > > 
> > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > 
> > > > On Sun, Sep 5, 2010 at 12:57 PM, Shay Banon  
> > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > 
> > > > > Open an issue request, they can be added to the URI option as well. I  
> > > > > think  
> > > > > that you are missing a lot of functionality by just using the search  
> > > > > with  
> > > > > URI option. There shouldn't really be a problem providing a body in  
> > > > > the  
> > > > > search request, no?
> > > > > 
> > > > > On Sun, Sep 5, 2010 at 9:27 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > Currently, my Elasticsearch setup is accessed through GET requests.  
> > > > > > The returned fields are specified through the "fields" option in the  
> > > > > > GET URI.
> > > > > > 
> > > > > > It would be good if I can specify the object field also in the GET  
> > > > > > request and return the JSON format of the object field.
> > > > > > 
> > > > > > Alternately, I can make use of providing the script fields in the  
> > > > > > URI  
> > > > > > of a GET request, if it is possible.
> > > > > > 
> > > > > > Regards,  
> > > > > > Mahendra
> > > > > > 
> > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > > > 
> > > > > > On Fri, Sep 3, 2010 at 2:02 PM, Shay Banon wrote:
> > > > > > 
> > > > > > > No, only through the script fields. What are you missing, the  
> > > > > > > option  
> > > > > > > to  
> > > > > > > provide script fields in the URI of a GET request.
> > > > > > > 
> > > > > > > On Fri, Sep 3, 2010 at 10:28 AM, Mahendra M \<[mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)
> > > 
> > > > > > > wrote:
> > > > > > > 
> > > > > > > > Hi,
> > > > > > > > 
> > > > > > > > I guess the latest commit (349) adds this feature. Thanks a lot  
> > > > > > > > 🙂
> > > > > > > > 
> > > > > > > > I have one doubt regarding the "script\_fields" option. I guess it  
> > > > > > > > is  
> > > > > > > > not available through the URI request method.
> > > > > > > > 
> > > > > > > > Also is it possible to obtain the object via the "fields" option  
> > > > > > > > ?  
> > > > > > > > By specifying
> > > > > > > > 
> > > > > > > > fields=...,...,doc.price OR  
> > > > > > > > fields=...,...,\_source.price
> > > > > > > > 
> > > > > > > > Regards,  
> > > > > > > > Mahendra
> > > > > > > > 
> > > > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > > > > > 
> > > > > > > > On Tue, Aug 31, 2010 at 1:48 PM, Shay Banon  
> > > > > > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > > > > > 
> > > > > > > > > Its not possible currently. There is a feature request to allow  
> > > > > > > > > to  
> > > > > > > > > return  
> > > > > > > > > parts of the \_source json (as well as use it for highlighting).  
> > > > > > > > > -shay.bnaon
> > > > > > > > > 
> > > > > > > > > On Tue, Aug 31, 2010 at 10:22 AM, Mahendra M  
> > > > > > > > > [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > > > > > wrote:
> > > > > > > > > 
> > > > > > > > > > Hi,
> > > > > > > > > > 
> > > > > > > > > > In the documents that I index, I have a field of 'object'  
> > > > > > > > > > type.  
> > > > > > > > > > Mapped as follows.
> > > > > > > > > > 
> > > > > > > > > > ```
> > > > > > > > > > "price" : {
> > > > > > > > > > "type" : "object",
> > > > > > > > > > "dynamic" : true,
> > > > > > > > > > "enabled" : true,
> > > > > > > > > > "store" : true,
> > > > > > > > > > "include_in_all": false
> > > > > > > > > > },
> > > > > > > > > > 
> > > > > > > > > > ```
> > > > > > > > > > 
> > > > > > > > > > The documents will have different keys for this as follows.  
> > > > > > > > > > These  
> > > > > > > > > > may  
> > > > > > > > > > be fixed or varying.  
> > > > > > > > > > 'price' : {  
> > > > > > > > > > 'us' : 1.0,  
> > > > > > > > > > 'uk' : 2.0  
> > > > > > > > > > }
> > > > > > > > > > 
> > > > > > > > > > My requirement, is that while querying, I need the price field  
> > > > > > > > > > as-is  
> > > > > > > > > > by specifying  
> > > > > > > > > > the "fields" option. In this example, I give -  
> > > > > > > > > > fields=price
> > > > > > > > > > 
> > > > > > > > > > However, I get the error:  
> > > > > > > > > > reason: "FetchPhaseExecutionException[[index\_name][0]:  
> > > > > > > > > > query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping for  
> > > > > > > > > > field  
> > > > > > > > > > [price]]]
> > > > > > > > > > 
> > > > > > > > > > Is it possible to retrieve an object, in the JSON format as is  
> > > > > > > > > > ?  
> > > > > > > > > > Or  
> > > > > > > > > > am  
> > > > > > > > > > I doing it incorrectly ?
> > > > > > > > > > 
> > > > > > > > > > I do not want to retrieve the entire '\_source' for getting  
> > > > > > > > > > just  
> > > > > > > > > > the  
> > > > > > > > > > "price" fields within it.
> > > > > > > > > > 
> > > > > > > > > > Regards,  
> > > > > > > > > > Mahendra
> > > > > > > > > > 
> > > > > > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<div class="post-metadata">

**Author:** ![Mahendra\_M](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahendra_m/32/3128_2.png) [@Mahendra\_M](https://discuss.elastic.co/u/Mahendra_M)\
**Post date:** [September 6, 2010, 9:22am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/12 "2010-09-06T09:22:25Z")

</div>

Oh cool.

Will test it out thoroughly after you push it 🙂

Thanks ..

On Mon, Sep 6, 2010 at 2:08 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> ok, was wrong about not being able to identify it, it actually can be  
> identified quite simply. Revised your issue you opened to  
> this: [Search API: Automatically identify "script" fields on the field elements in search · Issue #357 · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/issue/357). Have  
> something already running locally, will push later today.
> 
> On Mon, Sep 6, 2010 at 10:15 AM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)  
> wrote:
> 
> > Yea, sure, I will come up with a schema for this.
> > 
> > On Mon, Sep 6, 2010 at 10:13 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:
> > 
> > > Hmmm, i understand the problem.
> > > 
> > > In that case, would it be possible to use script fields in the search URI  
> > > ?
> > > 
> > > Regards,  
> > > Mahendra
> > > 
> > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > 
> > > On Mon, Sep 6, 2010 at 12:31 PM, Shay Banon  
> > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > 
> > > > The problem with using fields is that I can't tell between ones that  
> > > > try and  
> > > > fetch a stored field, compared to script fields that will result in  
> > > > getting  
> > > > the source... .  
> > > > -shay.banon
> > > > 
> > > > On Mon, Sep 6, 2010 at 7:48 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > I have opened an issue request for this (#357).
> > > > > 
> > > > > Yes, I know that I am missing on quite a lot of functionality by using  
> > > > > just the URI option, but this is used in clients which have very  
> > > > > limited resources. The more powerful clients use the query API.
> > > > > 
> > > > > I have exposed the URI to very tiny embedded devices which need to  
> > > > > query Elasticsearch. The search URI is a simple option for them.
> > > > > 
> > > > > Another reason is, by using the "fields" API, the output of  
> > > > > Elasticsearch can be made very similar to the output of couchdb views.  
> > > > > So, clients accessing couchdb and elasticsearch can have the same  
> > > > > format for accessing data.
> > > > > 
> > > > > Regards,  
> > > > > Mahendra
> > > > > 
> > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > > 
> > > > > On Sun, Sep 5, 2010 at 12:57 PM, Shay Banon  
> > > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > > 
> > > > > > Open an issue request, they can be added to the URI option as well.  
> > > > > > I  
> > > > > > think  
> > > > > > that you are missing a lot of functionality by just using the search  
> > > > > > with  
> > > > > > URI option. There shouldn't really be a problem providing a body in  
> > > > > > the  
> > > > > > search request, no?
> > > > > > 
> > > > > > On Sun, Sep 5, 2010 at 9:27 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > > wrote:
> > > > > > 
> > > > > > > Hi,
> > > > > > > 
> > > > > > > Currently, my Elasticsearch setup is accessed through GET requests.  
> > > > > > > The returned fields are specified through the "fields" option in  
> > > > > > > the  
> > > > > > > GET URI.
> > > > > > > 
> > > > > > > It would be good if I can specify the object field also in the GET  
> > > > > > > request and return the JSON format of the object field.
> > > > > > > 
> > > > > > > Alternately, I can make use of providing the script fields in the  
> > > > > > > URI  
> > > > > > > of a GET request, if it is possible.
> > > > > > > 
> > > > > > > Regards,  
> > > > > > > Mahendra
> > > > > > > 
> > > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > > > > 
> > > > > > > On Fri, Sep 3, 2010 at 2:02 PM, Shay Banon wrote:
> > > > > > > 
> > > > > > > > No, only through the script fields. What are you missing, the  
> > > > > > > > option  
> > > > > > > > to  
> > > > > > > > provide script fields in the URI of a GET request.
> > > > > > > > 
> > > > > > > > On Fri, Sep 3, 2010 at 10:28 AM, Mahendra M  
> > > > > > > > [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > > > > wrote:
> > > > > > > > 
> > > > > > > > > Hi,
> > > > > > > > > 
> > > > > > > > > I guess the latest commit (349) adds this feature. Thanks a lot  
> > > > > > > > > 🙂
> > > > > > > > > 
> > > > > > > > > I have one doubt regarding the "script\_fields" option. I guess  
> > > > > > > > > it is  
> > > > > > > > > not available through the URI request method.
> > > > > > > > > 
> > > > > > > > > Also is it possible to obtain the object via the "fields" option  
> > > > > > > > > ?  
> > > > > > > > > By specifying
> > > > > > > > > 
> > > > > > > > > fields=...,...,doc.price OR  
> > > > > > > > > fields=...,...,\_source.price
> > > > > > > > > 
> > > > > > > > > Regards,  
> > > > > > > > > Mahendra
> > > > > > > > > 
> > > > > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > > > > > > 
> > > > > > > > > On Tue, Aug 31, 2010 at 1:48 PM, Shay Banon  
> > > > > > > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > > > > > > 
> > > > > > > > > > Its not possible currently. There is a feature request to  
> > > > > > > > > > allow to  
> > > > > > > > > > return  
> > > > > > > > > > parts of the \_source json (as well as use it for  
> > > > > > > > > > highlighting).  
> > > > > > > > > > -shay.bnaon
> > > > > > > > > > 
> > > > > > > > > > On Tue, Aug 31, 2010 at 10:22 AM, Mahendra M  
> > > > > > > > > > [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > > > > > > wrote:
> > > > > > > > > > 
> > > > > > > > > > > Hi,
> > > > > > > > > > > 
> > > > > > > > > > > In the documents that I index, I have a field of 'object'  
> > > > > > > > > > > type.  
> > > > > > > > > > > Mapped as follows.
> > > > > > > > > > > 
> > > > > > > > > > > ```
> > > > > > > > > > > "price" : {
> > > > > > > > > > > "type" : "object",
> > > > > > > > > > > "dynamic" : true,
> > > > > > > > > > > "enabled" : true,
> > > > > > > > > > > "store" : true,
> > > > > > > > > > > "include_in_all": false
> > > > > > > > > > > },
> > > > > > > > > > > 
> > > > > > > > > > > ```
> > > > > > > > > > > 
> > > > > > > > > > > The documents will have different keys for this as follows.  
> > > > > > > > > > > These  
> > > > > > > > > > > may  
> > > > > > > > > > > be fixed or varying.  
> > > > > > > > > > > 'price' : {  
> > > > > > > > > > > 'us' : 1.0,  
> > > > > > > > > > > 'uk' : 2.0  
> > > > > > > > > > > }
> > > > > > > > > > > 
> > > > > > > > > > > My requirement, is that while querying, I need the price  
> > > > > > > > > > > field  
> > > > > > > > > > > as-is  
> > > > > > > > > > > by specifying  
> > > > > > > > > > > the "fields" option. In this example, I give -  
> > > > > > > > > > > fields=price
> > > > > > > > > > > 
> > > > > > > > > > > However, I get the error:  
> > > > > > > > > > > reason: "FetchPhaseExecutionException[[index\_name][0]:  
> > > > > > > > > > > query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping  
> > > > > > > > > > > for  
> > > > > > > > > > > field  
> > > > > > > > > > > [price]]]
> > > > > > > > > > > 
> > > > > > > > > > > Is it possible to retrieve an object, in the JSON format as  
> > > > > > > > > > > is ?  
> > > > > > > > > > > Or  
> > > > > > > > > > > am  
> > > > > > > > > > > I doing it incorrectly ?
> > > > > > > > > > > 
> > > > > > > > > > > I do not want to retrieve the entire '\_source' for getting  
> > > > > > > > > > > just  
> > > > > > > > > > > the  
> > > > > > > > > > > "price" fields within it.
> > > > > > > > > > > 
> > > > > > > > > > > Regards,  
> > > > > > > > > > > Mahendra
> > > > > > > > > > > 
> > > > > > > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)

--  
Mahendra

[http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<div class="post-metadata">

**Author:** ![Mahendra\_M](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahendra_m/32/3128_2.png) [@Mahendra\_M](https://discuss.elastic.co/u/Mahendra_M)\
**Post date:** [September 7, 2010, 7:19am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/13 "2010-09-07T07:19:58Z")

</div>

Hi,

I checked out the latest version and checked out this feature.

Providing fields=x,y,\_source.field\_name works great now.

Thanks a lot Shay 🙂

Regards,  
Mahendra

[http://twitter.com/mahendra](http://twitter.com/mahendra)

On Mon, Sep 6, 2010 at 2:52 PM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:

> Oh cool.
> 
> Will test it out thoroughly after you push it 🙂
> 
> Thanks ..
> 
> On Mon, Sep 6, 2010 at 2:08 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > ok, was wrong about not being able to identify it, it actually can be  
> > identified quite simply. Revised your issue you opened to  
> > this: [Search API: Automatically identify "script" fields on the field elements in search · Issue #357 · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/issue/357). Have  
> > something already running locally, will push later today.
> > 
> > On Mon, Sep 6, 2010 at 10:15 AM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)  
> > wrote:
> > 
> > > Yea, sure, I will come up with a schema for this.
> > > 
> > > On Mon, Sep 6, 2010 at 10:13 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com) wrote:
> > > 
> > > > Hmmm, i understand the problem.
> > > > 
> > > > In that case, would it be possible to use script fields in the search URI  
> > > > ?
> > > > 
> > > > Regards,  
> > > > Mahendra
> > > > 
> > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > 
> > > > On Mon, Sep 6, 2010 at 12:31 PM, Shay Banon  
> > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > 
> > > > > The problem with using fields is that I can't tell between ones that  
> > > > > try and  
> > > > > fetch a stored field, compared to script fields that will result in  
> > > > > getting  
> > > > > the source... .  
> > > > > -shay.banon
> > > > > 
> > > > > On Mon, Sep 6, 2010 at 7:48 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > I have opened an issue request for this (#357).
> > > > > > 
> > > > > > Yes, I know that I am missing on quite a lot of functionality by using  
> > > > > > just the URI option, but this is used in clients which have very  
> > > > > > limited resources. The more powerful clients use the query API.
> > > > > > 
> > > > > > I have exposed the URI to very tiny embedded devices which need to  
> > > > > > query Elasticsearch. The search URI is a simple option for them.
> > > > > > 
> > > > > > Another reason is, by using the "fields" API, the output of  
> > > > > > Elasticsearch can be made very similar to the output of couchdb views.  
> > > > > > So, clients accessing couchdb and elasticsearch can have the same  
> > > > > > format for accessing data.
> > > > > > 
> > > > > > Regards,  
> > > > > > Mahendra
> > > > > > 
> > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > > > 
> > > > > > On Sun, Sep 5, 2010 at 12:57 PM, Shay Banon  
> > > > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > > > 
> > > > > > > Open an issue request, they can be added to the URI option as well.  
> > > > > > > I  
> > > > > > > think  
> > > > > > > that you are missing a lot of functionality by just using the search  
> > > > > > > with  
> > > > > > > URI option. There shouldn't really be a problem providing a body in  
> > > > > > > the  
> > > > > > > search request, no?
> > > > > > > 
> > > > > > > On Sun, Sep 5, 2010 at 9:27 AM, Mahendra M [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > > > wrote:
> > > > > > > 
> > > > > > > > Hi,
> > > > > > > > 
> > > > > > > > Currently, my Elasticsearch setup is accessed through GET requests.  
> > > > > > > > The returned fields are specified through the "fields" option in  
> > > > > > > > the  
> > > > > > > > GET URI.
> > > > > > > > 
> > > > > > > > It would be good if I can specify the object field also in the GET  
> > > > > > > > request and return the JSON format of the object field.
> > > > > > > > 
> > > > > > > > Alternately, I can make use of providing the script fields in the  
> > > > > > > > URI  
> > > > > > > > of a GET request, if it is possible.
> > > > > > > > 
> > > > > > > > Regards,  
> > > > > > > > Mahendra
> > > > > > > > 
> > > > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > > > > > 
> > > > > > > > On Fri, Sep 3, 2010 at 2:02 PM, Shay Banon wrote:
> > > > > > > > 
> > > > > > > > > No, only through the script fields. What are you missing, the  
> > > > > > > > > option  
> > > > > > > > > to  
> > > > > > > > > provide script fields in the URI of a GET request.
> > > > > > > > > 
> > > > > > > > > On Fri, Sep 3, 2010 at 10:28 AM, Mahendra M  
> > > > > > > > > [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > > > > > wrote:
> > > > > > > > > 
> > > > > > > > > > Hi,
> > > > > > > > > > 
> > > > > > > > > > I guess the latest commit (349) adds this feature. Thanks a lot  
> > > > > > > > > > 🙂
> > > > > > > > > > 
> > > > > > > > > > I have one doubt regarding the "script\_fields" option. I guess  
> > > > > > > > > > it is  
> > > > > > > > > > not available through the URI request method.
> > > > > > > > > > 
> > > > > > > > > > Also is it possible to obtain the object via the "fields" option  
> > > > > > > > > > ?  
> > > > > > > > > > By specifying
> > > > > > > > > > 
> > > > > > > > > > fields=...,...,doc.price OR  
> > > > > > > > > > fields=...,...,\_source.price
> > > > > > > > > > 
> > > > > > > > > > Regards,  
> > > > > > > > > > Mahendra
> > > > > > > > > > 
> > > > > > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> > > > > > > > > > 
> > > > > > > > > > On Tue, Aug 31, 2010 at 1:48 PM, Shay Banon  
> > > > > > > > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > > > > > > > 
> > > > > > > > > > > Its not possible currently. There is a feature request to  
> > > > > > > > > > > allow to  
> > > > > > > > > > > return  
> > > > > > > > > > > parts of the \_source json (as well as use it for  
> > > > > > > > > > > highlighting).  
> > > > > > > > > > > -shay.bnaon
> > > > > > > > > > > 
> > > > > > > > > > > On Tue, Aug 31, 2010 at 10:22 AM, Mahendra M  
> > > > > > > > > > > [mahendra.m@gmail.com](mailto:mahendra.m@gmail.com)  
> > > > > > > > > > > wrote:
> > > > > > > > > > > 
> > > > > > > > > > > > Hi,
> > > > > > > > > > > > 
> > > > > > > > > > > > In the documents that I index, I have a field of 'object'  
> > > > > > > > > > > > type.  
> > > > > > > > > > > > Mapped as follows.
> > > > > > > > > > > > 
> > > > > > > > > > > > ```
> > > > > > > > > > > > "price" : {
> > > > > > > > > > > > "type" : "object",
> > > > > > > > > > > > "dynamic" : true,
> > > > > > > > > > > > "enabled" : true,
> > > > > > > > > > > > "store" : true,
> > > > > > > > > > > > "include_in_all": false
> > > > > > > > > > > > },
> > > > > > > > > > > > 
> > > > > > > > > > > > ```
> > > > > > > > > > > > 
> > > > > > > > > > > > The documents will have different keys for this as follows.  
> > > > > > > > > > > > These  
> > > > > > > > > > > > may  
> > > > > > > > > > > > be fixed or varying.  
> > > > > > > > > > > > 'price' : {  
> > > > > > > > > > > > 'us' : 1.0,  
> > > > > > > > > > > > 'uk' : 2.0  
> > > > > > > > > > > > }
> > > > > > > > > > > > 
> > > > > > > > > > > > My requirement, is that while querying, I need the price  
> > > > > > > > > > > > field  
> > > > > > > > > > > > as-is  
> > > > > > > > > > > > by specifying  
> > > > > > > > > > > > the "fields" option. In this example, I give -  
> > > > > > > > > > > > fields=price
> > > > > > > > > > > > 
> > > > > > > > > > > > However, I get the error:  
> > > > > > > > > > > > reason: "FetchPhaseExecutionException[[index\_name][0]:  
> > > > > > > > > > > > query[\_all:_a_],from[0],size[10]: Fetch Failed [No mapping  
> > > > > > > > > > > > for  
> > > > > > > > > > > > field  
> > > > > > > > > > > > [price]]]
> > > > > > > > > > > > 
> > > > > > > > > > > > Is it possible to retrieve an object, in the JSON format as  
> > > > > > > > > > > > is ?  
> > > > > > > > > > > > Or  
> > > > > > > > > > > > am  
> > > > > > > > > > > > I doing it incorrectly ?
> > > > > > > > > > > > 
> > > > > > > > > > > > I do not want to retrieve the entire '\_source' for getting  
> > > > > > > > > > > > just  
> > > > > > > > > > > > the  
> > > > > > > > > > > > "price" fields within it.
> > > > > > > > > > > > 
> > > > > > > > > > > > Regards,  
> > > > > > > > > > > > Mahendra
> > > > > > > > > > > > 
> > > > > > > > > > > > [http://twitter.com/mahendra](http://twitter.com/mahendra)
> 
> --  
> Mahendra
> 
> [http://twitter.com/mahendra](http://twitter.com/mahendra)

---

<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, 4:19am UTC](https://discuss.elastic.co/t/error-while-retrieving-an-object-field/3279/14 "2017-07-06T04:19:40Z")

</div>


