# Changing the field names of search results

**URL:** <https://discuss.elastic.co/t/changing-the-field-names-of-search-results/8719>\
**Category:** Elasticsearch\
**Created:** [August 11, 2012, 5:56pm UTC](https://discuss.elastic.co/t/changing-the-field-names-of-search-results/8719 "2012-08-11T17:56:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Huang\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_huang_2/32/2641_2.png) [@Mark\_Huang\_2](https://discuss.elastic.co/u/Mark_Huang_2)\
**Post date:** [August 11, 2012, 5:56pm UTC](https://discuss.elastic.co/t/changing-the-field-names-of-search-results/8719/1 "2012-08-11T17:56:24Z")

</div>

Hi,

I'm relatively new to elasticsearch, so please bare with me. I read  
through the documentation for two days and tried to write my own mapper for  
some sample data. I am the CouchDB River plugin to index my CouchDB  
database. I also use Python's pyes library to query against elasticsearch.

I'm encountering a problem with my search results at the moment. I have a  
gist at the following link:

> <https://gist.github.com/zhenghao1/3325910>

If you look at the python code, I specified the fields that I want returned  
from the search. However, I have to use the "dot notation" to specify  
which field I want returned. Look at the "product.json" file to see a  
rough structure of my indexed document. Things like ID and Key are on the  
very outer level of the product document so it's fine to just refer to them  
using they names directly. However, I have a content JSON object which  
contains keys like brand, name, description, etc. These fields have to be  
referenced using the dot notation like : "content.description" or  
"content.brand".

The search results contain keys with the names being set with the "dot  
notation". I will pass this resultset to my frontend and have my widget  
framework (I use KendoUI) parse the data. However, it fails in Firebug  
saying that content is undefined because the key name is "content.brand",  
and the framework thinks that content is an object with an attribute brand  
but the search results actually have a key named "content.brand"!

I tried using the index\_name attribute during mapping but it didn't seem to  
work. \* My question is: "Is there a way to change the output of the key  
names to say, "brand" instead of "content.brand" ? "\*  
\*  
\*  
Am I confusing any of you? If so, please let me know, I'll be glad to  
explain my problem again.

Regards,  
Mark Huang

--

---

<div class="post-metadata">

**Author:** ![Mark\_Huang\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_huang_2/32/2641_2.png) [@Mark\_Huang\_2](https://discuss.elastic.co/u/Mark_Huang_2)\
**Post date:** [August 12, 2012, 2:51pm UTC](https://discuss.elastic.co/t/changing-the-field-names-of-search-results/8719/2 "2012-08-12T14:51:50Z")

</div>

Please, anyone can help?

On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:

> Hi,
> 
> I'm relatively new to elasticsearch, so please bare with me. I read  
> through the documentation for two days and tried to write my own mapper for  
> some sample data. I am the CouchDB River plugin to index my CouchDB  
> database. I also use Python's pyes library to query against elasticsearch.
> 
> I'm encountering a problem with my search results at the moment. I have a  
> gist at the following link:
> 
> [Product listing using elastic search with python's pyes · GitHub](https://gist.github.com/3325910)
> 
> If you look at the python code, I specified the fields that I want  
> returned from the search. However, I have to use the "dot notation" to  
> specify which field I want returned. Look at the "product.json" file to  
> see a rough structure of my indexed document. Things like ID and Key are  
> on the very outer level of the product document so it's fine to just refer  
> to them using they names directly. However, I have a content JSON object  
> which contains keys like brand, name, description, etc. These fields have  
> to be referenced using the dot notation like : "content.description" or  
> "content.brand".
> 
> The search results contain keys with the names being set with the "dot  
> notation". I will pass this resultset to my frontend and have my widget  
> framework (I use KendoUI) parse the data. However, it fails in Firebug  
> saying that content is undefined because the key name is "content.brand",  
> and the framework thinks that content is an object with an attribute brand  
> but the search results actually have a key named "content.brand"!
> 
> I tried using the index\_name attribute during mapping but it didn't seem  
> to work. \* My question is: "Is there a way to change the output of the  
> key names to say, "brand" instead of "content.brand" ? "\*  
> \*  
> \*  
> Am I confusing any of you? If so, please let me know, I'll be glad to  
> explain my problem again.
> 
> Regards,  
> Mark Huang

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 12, 2012, 3:04pm UTC](https://discuss.elastic.co/t/changing-the-field-names-of-search-results/8719/3 "2012-08-12T15:04:14Z")

</div>

Have a look at scripts: [https://github.com/elasticsearch/elasticsearch-river-couchdb/blob/master/README.md](https://github.com/elasticsearch/elasticsearch-river-couchdb/blob/master/README.md)

It should help.

David

--

Le 12 août 2012 à 16:51, Mark Huang [zhenghao12@gmail.com](mailto:zhenghao12@gmail.com) a écrit :

> Please, anyone can help?
> 
> On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:  
> Hi,
> 
> I'm relatively new to elasticsearch, so please bare with me. I read through the documentation for two days and tried to write my own mapper for some sample data. I am the CouchDB River plugin to index my CouchDB database. I also use Python's pyes library to query against elasticsearch.
> 
> I'm encountering a problem with my search results at the moment. I have a gist at the following link:
> 
> [Product listing using elastic search with python's pyes · GitHub](https://gist.github.com/3325910)
> 
> If you look at the python code, I specified the fields that I want returned from the search. However, I have to use the "dot notation" to specify which field I want returned. Look at the "product.json" file to see a rough structure of my indexed document. Things like ID and Key are on the very outer level of the product document so it's fine to just refer to them using they names directly. However, I have a content JSON object which contains keys like brand, name, description, etc. These fields have to be referenced using the dot notation like : "content.description" or "content.brand".
> 
> The search results contain keys with the names being set with the "dot notation". I will pass this resultset to my frontend and have my widget framework (I use KendoUI) parse the data. However, it fails in Firebug saying that content is undefined because the key name is "content.brand", and the framework thinks that content is an object with an attribute brand but the search results actually have a key named "content.brand"!
> 
> I tried using the index\_name attribute during mapping but it didn't seem to work. My question is: "Is there a way to change the output of the key names to say, "brand" instead of "content.brand" ? "
> 
> Am I confusing any of you? If so, please let me know, I'll be glad to explain my problem again.
> 
> ## Regards, Mark Huang

--

---

<div class="post-metadata">

**Author:** ![Mark\_Huang\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_huang_2/32/2641_2.png) [@Mark\_Huang\_2](https://discuss.elastic.co/u/Mark_Huang_2)\
**Post date:** [August 12, 2012, 3:16pm UTC](https://discuss.elastic.co/t/changing-the-field-names-of-search-results/8719/4 "2012-08-12T15:16:06Z")

</div>

Sorry, I don't see how this helps. I did mention I am already using the  
Elasticsearch river couchdb plugin. I don't think it has anything to do  
with this plugin.

On Sun, Aug 12, 2012 at 11:04 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Have a look at scripts:  
> [https://github.com/elasticsearch/elasticsearch-river-couchdb/blob/master/README.md](https://github.com/elasticsearch/elasticsearch-river-couchdb/blob/master/README.md)
> 
> It should help.
> 
> David
> 
> --
> 
> Le 12 août 2012 à 16:51, Mark Huang [zhenghao12@gmail.com](mailto:zhenghao12@gmail.com) a écrit :
> 
> Please, anyone can help?
> 
> On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:
> 
> > Hi,
> > 
> > I'm relatively new to elasticsearch, so please bare with me. I read  
> > through the documentation for two days and tried to write my own mapper for  
> > some sample data. I am the CouchDB River plugin to index my CouchDB  
> > database. I also use Python's pyes library to query against elasticsearch.
> > 
> > I'm encountering a problem with my search results at the moment. I have  
> > a gist at the following link:
> > 
> > [https://gist.github.com/\*\*3325910](https://gist.github.com/**3325910) [https://gist.github.com/3325910](https://gist.github.com/3325910)
> > 
> > If you look at the python code, I specified the fields that I want  
> > returned from the search. However, I have to use the "dot notation" to  
> > specify which field I want returned. Look at the "product.json" file to  
> > see a rough structure of my indexed document. Things like ID and Key are  
> > on the very outer level of the product document so it's fine to just refer  
> > to them using they names directly. However, I have a content JSON object  
> > which contains keys like brand, name, description, etc. These fields have  
> > to be referenced using the dot notation like : "content.description" or  
> > "content.brand".
> > 
> > The search results contain keys with the names being set with the "dot  
> > notation". I will pass this resultset to my frontend and have my widget  
> > framework (I use KendoUI) parse the data. However, it fails in Firebug  
> > saying that content is undefined because the key name is "content.brand",  
> > and the framework thinks that content is an object with an attribute brand  
> > but the search results actually have a key named "content.brand"!
> > 
> > I tried using the index\_name attribute during mapping but it didn't seem  
> > to work. \* My question is: "Is there a way to change the output of the  
> > key names to say, "brand" instead of "content.brand" ? "\*  
> > \*  
> > \*  
> > Am I confusing any of you? If so, please let me know, I'll be glad to  
> > explain my problem again.
> > 
> > Regards,  
> > Mark Huang
> 
> --
> 
> --

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 12, 2012, 4:15pm UTC](https://discuss.elastic.co/t/changing-the-field-names-of-search-results/8719/5 "2012-08-12T16:15:46Z")

</div>

Try something like:  
{ "type" : "couchdb", "couchdb" : { "script" : "ctx.doc.brand = ctx.doc.content.brand;ctx.doc.content.brand=null;" } }  
Does it help?

--

Le 12 août 2012 à 17:16, Zhenghao Huang [zhenghao12@gmail.com](mailto:zhenghao12@gmail.com) a écrit :

> Sorry, I don't see how this helps. I did mention I am already using the Elasticsearch river couchdb plugin. I don't think it has anything to do with this plugin.
> 
> On Sun, Aug 12, 2012 at 11:04 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
> Have a look at scripts: [https://github.com/elasticsearch/elasticsearch-river-couchdb/blob/master/README.md](https://github.com/elasticsearch/elasticsearch-river-couchdb/blob/master/README.md)
> 
> It should help.
> 
> David
> 
> --
> 
> Le 12 août 2012 à 16:51, Mark Huang [zhenghao12@gmail.com](mailto:zhenghao12@gmail.com) a écrit :
> 
> > Please, anyone can help?
> > 
> > On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:  
> > Hi,
> > 
> > I'm relatively new to elasticsearch, so please bare with me. I read through the documentation for two days and tried to write my own mapper for some sample data. I am the CouchDB River plugin to index my CouchDB database. I also use Python's pyes library to query against elasticsearch.
> > 
> > I'm encountering a problem with my search results at the moment. I have a gist at the following link:
> > 
> > [Product listing using elastic search with python's pyes · GitHub](https://gist.github.com/3325910)
> > 
> > If you look at the python code, I specified the fields that I want returned from the search. However, I have to use the "dot notation" to specify which field I want returned. Look at the "product.json" file to see a rough structure of my indexed document. Things like ID and Key are on the very outer level of the product document so it's fine to just refer to them using they names directly. However, I have a content JSON object which contains keys like brand, name, description, etc. These fields have to be referenced using the dot notation like : "content.description" or "content.brand".
> > 
> > The search results contain keys with the names being set with the "dot notation". I will pass this resultset to my frontend and have my widget framework (I use KendoUI) parse the data. However, it fails in Firebug saying that content is undefined because the key name is "content.brand", and the framework thinks that content is an object with an attribute brand but the search results actually have a key named "content.brand"!
> > 
> > I tried using the index\_name attribute during mapping but it didn't seem to work. My question is: "Is there a way to change the output of the key names to say, "brand" instead of "content.brand" ? "
> > 
> > Am I confusing any of you? If so, please let me know, I'll be glad to explain my problem again.
> > 
> > ## Regards, Mark Huang
> 
> --
> 
> --

--

---

<div class="post-metadata">

**Author:** ![Mark\_Huang\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_huang_2/32/2641_2.png) [@Mark\_Huang\_2](https://discuss.elastic.co/u/Mark_Huang_2)\
**Post date:** [August 12, 2012, 4:42pm UTC](https://discuss.elastic.co/t/changing-the-field-names-of-search-results/8719/6 "2012-08-12T16:42:49Z")

</div>

Ok...so you mean, if I want something within content to have an output  
field name without the dot-notation, I have to remap it to the first level  
using script?

That seems rather tedious...I'll give it a try thanks. There has to be a  
much better way of doing this right?!

On Monday, 13 August 2012 00:15:46 UTC+8, David Pilato wrote:

> Try something like:
> 
> {  
> "type" : "couchdb",  
> "couchdb" : {  
> "script" : "ctx.doc.brand = ctx.doc.content.brand;ctx.doc.content.brand=null;"  
> }  
> }
> 
> Does it help?
> 
> --
> 
> Le 12 août 2012 à 17:16, Zhenghao Huang \<[zheng...@gmail.com](mailto:zheng...@gmail.com) \<javascript:\>\>  
> a écrit :
> 
> Sorry, I don't see how this helps. I did mention I am already using the  
> Elasticsearch river couchdb plugin. I don't think it has anything to do  
> with this plugin.
> 
> On Sun, Aug 12, 2012 at 11:04 PM, David Pilato \<[da...@pilato.fr](mailto:da...@pilato.fr)\<javascript:\>
> 
> > wrote:
> 
> > Have a look at scripts:  
> > [https://github.com/elasticsearch/elasticsearch-river-couchdb/blob/master/README.md](https://github.com/elasticsearch/elasticsearch-river-couchdb/blob/master/README.md)
> > 
> > It should help.
> > 
> > David
> > 
> > --
> > 
> > Le 12 août 2012 à 16:51, Mark Huang \<[zheng...@gmail.com](mailto:zheng...@gmail.com) \<javascript:\>\> a  
> > écrit :
> > 
> > Please, anyone can help?
> > 
> > On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:
> > 
> > > Hi,
> > > 
> > > I'm relatively new to elasticsearch, so please bare with me. I read  
> > > through the documentation for two days and tried to write my own mapper for  
> > > some sample data. I am the CouchDB River plugin to index my CouchDB  
> > > database. I also use Python's pyes library to query against elasticsearch.
> > > 
> > > I'm encountering a problem with my search results at the moment. I have  
> > > a gist at the following link:
> > > 
> > > [https://gist.github.com/\*\*3325910](https://gist.github.com/**3325910) [https://gist.github.com/3325910](https://gist.github.com/3325910)
> > > 
> > > If you look at the python code, I specified the fields that I want  
> > > returned from the search. However, I have to use the "dot notation" to  
> > > specify which field I want returned. Look at the "product.json" file to  
> > > see a rough structure of my indexed document. Things like ID and Key are  
> > > on the very outer level of the product document so it's fine to just refer  
> > > to them using they names directly. However, I have a content JSON object  
> > > which contains keys like brand, name, description, etc. These fields have  
> > > to be referenced using the dot notation like : "content.description" or  
> > > "content.brand".
> > > 
> > > The search results contain keys with the names being set with the "dot  
> > > notation". I will pass this resultset to my frontend and have my widget  
> > > framework (I use KendoUI) parse the data. However, it fails in Firebug  
> > > saying that content is undefined because the key name is "content.brand",  
> > > and the framework thinks that content is an object with an attribute brand  
> > > but the search results actually have a key named "content.brand"!
> > > 
> > > I tried using the index\_name attribute during mapping but it didn't seem  
> > > to work. \* My question is: "Is there a way to change the output of the  
> > > key names to say, "brand" instead of "content.brand" ? "\*  
> > > \*  
> > > \*  
> > > Am I confusing any of you? If so, please let me know, I'll be glad to  
> > > explain my problem again.
> > > 
> > > Regards,  
> > > Mark Huang
> > 
> > --
> > 
> > --
> 
> --

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 12, 2012, 7:29pm UTC](https://discuss.elastic.co/t/changing-the-field-names-of-search-results/8719/7 "2012-08-12T19:29:45Z")

</div>

Yes. My opinion is that you should index documents as you want to retrieve it after. So I will do it that way.

My 2 cents.  
David

--

Le 12 août 2012 à 18:42, Mark Huang [zhenghao12@gmail.com](mailto:zhenghao12@gmail.com) a écrit :

> Ok...so you mean, if I want something within content to have an output field name without the dot-notation, I have to remap it to the first level using script?
> 
> That seems rather tedious...I'll give it a try thanks. There has to be a much better way of doing this right?!
> 
> On Monday, 13 August 2012 00:15:46 UTC+8, David Pilato wrote:  
> Try something like:  
> { "type" : "couchdb", "couchdb" : { "script" : "ctx.doc.brand = ctx.doc.content.brand;ctx.doc.content.brand=null;"  
> }  
> }  
> Does it help?
> 
> --
> 
> Le 12 août 2012 à 17:16, Zhenghao Huang [zheng...@gmail.com](mailto:zheng...@gmail.com) a écrit :
> 
> > Sorry, I don't see how this helps. I did mention I am already using the Elasticsearch river couchdb plugin. I don't think it has anything to do with this plugin.
> > 
> > On Sun, Aug 12, 2012 at 11:04 PM, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:  
> > Have a look at scripts: [https://github.com/elasticsearch/elasticsearch-river-couchdb/blob/master/README.md](https://github.com/elasticsearch/elasticsearch-river-couchdb/blob/master/README.md)
> > 
> > It should help.
> > 
> > David
> > 
> > --
> > 
> > Le 12 août 2012 à 16:51, Mark Huang [zheng...@gmail.com](mailto:zheng...@gmail.com) a écrit :
> > 
> > > Please, anyone can help?
> > > 
> > > On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:  
> > > Hi,
> > > 
> > > I'm relatively new to elasticsearch, so please bare with me. I read through the documentation for two days and tried to write my own mapper for some sample data. I am the CouchDB River plugin to index my CouchDB database. I also use Python's pyes library to query against elasticsearch.
> > > 
> > > I'm encountering a problem with my search results at the moment. I have a gist at the following link:
> > > 
> > > [Product listing using elastic search with python's pyes · GitHub](https://gist.github.com/3325910)
> > > 
> > > If you look at the python code, I specified the fields that I want returned from the search. However, I have to use the "dot notation" to specify which field I want returned. Look at the "product.json" file to see a rough structure of my indexed document. Things like ID and Key are on the very outer level of the product document so it's fine to just refer to them using they names directly. However, I have a content JSON object which contains keys like brand, name, description, etc. These fields have to be referenced using the dot notation like : "content.description" or "content.brand".
> > > 
> > > The search results contain keys with the names being set with the "dot notation". I will pass this resultset to my frontend and have my widget framework (I use KendoUI) parse the data. However, it fails in Firebug saying that content is undefined because the key name is "content.brand", and the framework thinks that content is an object with an attribute brand but the search results actually have a key named "content.brand"!
> > > 
> > > I tried using the index\_name attribute during mapping but it didn't seem to work. My question is: "Is there a way to change the output of the key names to say, "brand" instead of "content.brand" ? "
> > > 
> > > Am I confusing any of you? If so, please let me know, I'll be glad to explain my problem again.
> > > 
> > > ## Regards, Mark Huang
> > 
> > --
> > 
> > --
> 
> --

--

---

<div class="post-metadata">

**Author:** ![Mark\_Huang\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_huang_2/32/2641_2.png) [@Mark\_Huang\_2](https://discuss.elastic.co/u/Mark_Huang_2)\
**Post date:** [August 13, 2012, 9:41am UTC](https://discuss.elastic.co/t/changing-the-field-names-of-search-results/8719/8 "2012-08-13T09:41:35Z")

</div>

Tested this today and it did solved my problem. But it created another  
problem for me which I have just started a new thread[https://groups.google.com/forum/?fromgroups#!topic/elasticsearch/S0bmeMvnLyQ[1-25]](https://groups.google.com/forum/?fromgroups#!topic/elasticsearch/S0bmeMvnLyQ%5B1-25%5D)on. The problem I am facing is that, I want different fields for different  
types. That would mean I have to index my database based on type. Am I  
correct? I've been reading the docs here and there and I still can't  
figure out a solution.

On Sunday, 12 August 2012 14:29:45 UTC-5, David Pilato wrote:

> Yes. My opinion is that you should index documents as you want to retrieve  
> it after. So I will do it that way.
> 
> My 2 cents.  
> David
> 
> --
> 
> Le 12 août 2012 à 18:42, Mark Huang \<[zheng...@gmail.com](mailto:zheng...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> Ok...so you mean, if I want something within content to have an output  
> field name without the dot-notation, I have to remap it to the first level  
> using script?
> 
> That seems rather tedious...I'll give it a try thanks. There has to be a  
> much better way of doing this right?!
> 
> On Monday, 13 August 2012 00:15:46 UTC+8, David Pilato wrote:
> 
> > Try something like:
> > 
> > {  
> > "type" : "couchdb",  
> > "couchdb" : {  
> > "script" : "ctx.doc.brand = ctx.doc.content.brand;ctx.doc.content.brand=null;"  
> > }  
> > }
> > 
> > Does it help?
> > 
> > --
> > 
> > Le 12 août 2012 à 17:16, Zhenghao Huang [zheng...@gmail.com](mailto:zheng...@gmail.com) a écrit :
> > 
> > Sorry, I don't see how this helps. I did mention I am already using the  
> > Elasticsearch river couchdb plugin. I don't think it has anything to do  
> > with this plugin.
> > 
> > On Sun, Aug 12, 2012 at 11:04 PM, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> > 
> > > Have a look at scripts:  
> > > [https://github.com/elasticsearch/elasticsearch-river-couchdb/blob/master/README.md](https://github.com/elasticsearch/elasticsearch-river-couchdb/blob/master/README.md)
> > > 
> > > It should help.
> > > 
> > > David
> > > 
> > > --
> > > 
> > > Le 12 août 2012 à 16:51, Mark Huang [zheng...@gmail.com](mailto:zheng...@gmail.com) a écrit :
> > > 
> > > Please, anyone can help?
> > > 
> > > On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:
> > > 
> > > > Hi,
> > > > 
> > > > I'm relatively new to elasticsearch, so please bare with me. I read  
> > > > through the documentation for two days and tried to write my own mapper for  
> > > > some sample data. I am the CouchDB River plugin to index my CouchDB  
> > > > database. I also use Python's pyes library to query against elasticsearch.
> > > > 
> > > > I'm encountering a problem with my search results at the moment. I  
> > > > have a gist at the following link:
> > > > 
> > > > [https://gist.github.com/\*\*3325910](https://gist.github.com/**3325910) [https://gist.github.com/3325910](https://gist.github.com/3325910)
> > > > 
> > > > If you look at the python code, I specified the fields that I want  
> > > > returned from the search. However, I have to use the "dot notation" to  
> > > > specify which field I want returned. Look at the "product.json" file to  
> > > > see a rough structure of my indexed document. Things like ID and Key are  
> > > > on the very outer level of the product document so it's fine to just refer  
> > > > to them using they names directly. However, I have a content JSON object  
> > > > which contains keys like brand, name, description, etc. These fields have  
> > > > to be referenced using the dot notation like : "content.description" or  
> > > > "content.brand".
> > > > 
> > > > The search results contain keys with the names being set with the "dot  
> > > > notation". I will pass this resultset to my frontend and have my widget  
> > > > framework (I use KendoUI) parse the data. However, it fails in Firebug  
> > > > saying that content is undefined because the key name is "content.brand",  
> > > > and the framework thinks that content is an object with an attribute brand  
> > > > but the search results actually have a key named "content.brand"!
> > > > 
> > > > I tried using the index\_name attribute during mapping but it didn't  
> > > > seem to work. \* My question is: "Is there a way to change the output  
> > > > of the key names to say, "brand" instead of "content.brand" ? "\*  
> > > > \*  
> > > > \*  
> > > > Am I confusing any of you? If so, please let me know, I'll be glad to  
> > > > explain my problem again.
> > > > 
> > > > Regards,  
> > > > Mark Huang
> > > 
> > > --
> > > 
> > > --
> > 
> > --
> > 
> > --

--

---

<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:16am UTC](https://discuss.elastic.co/t/changing-the-field-names-of-search-results/8719/9 "2017-07-06T03:16:36Z")

</div>


