# Inclusion of fields while creating an aliases

**URL:** <https://discuss.elastic.co/t/inclusion-of-fields-while-creating-an-aliases/5754>\
**Category:** Elasticsearch\
**Created:** [November 3, 2011, 5:09am UTC](https://discuss.elastic.co/t/inclusion-of-fields-while-creating-an-aliases/5754 "2011-11-03T05:09:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![arien](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@arien](https://discuss.elastic.co/u/arien)\
**Post date:** [November 3, 2011, 5:09am UTC](https://discuss.elastic.co/t/inclusion-of-fields-while-creating-an-aliases/5754/1 "2011-11-03T05:09:29Z")

</div>

Hi;  
I have some small doubt regarding making an alias on 2 or 3 indexes  
that whether or not fields of your choice can be included while making  
an alias on individual index like we do in Database views.  
Thanks;

---

<div class="post-metadata">

**Author:** ![arien](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@arien](https://discuss.elastic.co/u/arien)\
**Post date:** [November 3, 2011, 5:50am UTC](https://discuss.elastic.co/t/inclusion-of-fields-while-creating-an-aliases/5754/2 "2011-11-03T05:50:27Z")

</div>

Hi;

I am retriving documents using source disabled as follows

{  
"fields": ,  
"\_source": {  
"enabled": false  
},  
"query": {  
"term": {  
"usersonmail": "ajay.padvi"  
}  
}  
}  
but still its showing me all the columns.Please someone clarify how to  
achieve retrieval of only wanted columns from an alias.

Thnks

On Nov 3, 10:09 am, arien [ajaypa...@gmail.com](mailto:ajaypa...@gmail.com) wrote:

> Hi;  
> I have some small doubt regarding making an alias on 2 or 3 indexes  
> that whether or not fields of your choice can be included while making  
> an alias on individual index like we do in Database views.  
> Thanks;

---

<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:** [November 3, 2011, 5:42pm UTC](https://discuss.elastic.co/t/inclusion-of-fields-while-creating-an-aliases/5754/3 "2011-11-03T17:42:35Z")

</div>

Disabling the source is done on the mapping side. When you create an index,  
you can have mappings for types, on them, you can disable storing the  
source.

On the search side, even if \_source is stored, you can set "fields" to an  
empty array, in which case the response will not include any fields (except  
for the id).

On Thu, Nov 3, 2011 at 7:50 AM, arien [ajaypadvi@gmail.com](mailto:ajaypadvi@gmail.com) wrote:

> Hi;
> 
> I am retriving documents using source disabled as follows
> 
> {  
> "fields": ,  
> "\_source": {  
> "enabled": false  
> },  
> "query": {  
> "term": {  
> "usersonmail": "ajay.padvi"  
> }  
> }  
> }  
> but still its showing me all the columns.Please someone clarify how to  
> achieve retrieval of only wanted columns from an alias.
> 
> Thnks
> 
> On Nov 3, 10:09 am, arien [ajaypa...@gmail.com](mailto:ajaypa...@gmail.com) wrote:
> 
> > Hi;  
> > I have some small doubt regarding making an alias on 2 or 3 indexes  
> > that whether or not fields of your choice can be included while making  
> > an alias on individual index like we do in Database views.  
> > Thanks;

---

<div class="post-metadata">

**Author:** ![arien](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@arien](https://discuss.elastic.co/u/arien)\
**Post date:** [November 3, 2011, 7:32pm UTC](https://discuss.elastic.co/t/inclusion-of-fields-while-creating-an-aliases/5754/4 "2011-11-03T19:32:19Z")

</div>

Hi shay;

Thanks for your reply.I disabled the source at mapping and getting  
appropriate results in search DSLs,But my requirement is to create a view  
like structure/alias on index so that i can specify those field to be shown  
during an alias creation time only like we do in SQLs views.But as far as i  
have observed an alias only supports filter and i was not able to specify  
wanted fields to be retrieved by any means in alias "add" action.  
The problem is related to database search where in where in i want to  
specify only those columns mapped according to privileges.

Please share and provide me some inputs whether can it be done in  
elasticsearch or not for which i will be very obliged.

Thnks;  
Arien.

On Thu, Nov 3, 2011 at 11:12 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Disabling the source is done on the mapping side. When you create an  
> index, you can have mappings for types, on them, you can disable storing  
> the source.
> 
> On the search side, even if \_source is stored, you can set "fields" to an  
> empty array, in which case the response will not include any fields (except  
> for the id).
> 
> On Thu, Nov 3, 2011 at 7:50 AM, arien [ajaypadvi@gmail.com](mailto:ajaypadvi@gmail.com) wrote:
> 
> > Hi;
> > 
> > I am retriving documents using source disabled as follows
> > 
> > {  
> > "fields": ,  
> > "\_source": {  
> > "enabled": false  
> > },  
> > "query": {  
> > "term": {  
> > "usersonmail": "ajay.padvi"  
> > }  
> > }  
> > }  
> > but still its showing me all the columns.Please someone clarify how to  
> > achieve retrieval of only wanted columns from an alias.
> > 
> > Thnks
> > 
> > On Nov 3, 10:09 am, arien [ajaypa...@gmail.com](mailto:ajaypa...@gmail.com) wrote:
> > 
> > > Hi;  
> > > I have some small doubt regarding making an alias on 2 or 3 indexes  
> > > that whether or not fields of your choice can be included while making  
> > > an alias on individual index like we do in Database views.  
> > > Thanks;

---

<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:** [November 8, 2011, 2:51am UTC](https://discuss.elastic.co/t/inclusion-of-fields-while-creating-an-aliases/5754/5 "2011-11-08T02:51:35Z")

</div>

Aliases are not similar to SQL views, so you can't really ask only for  
those aliases to have specific fields, and have \_source disabled in the  
actual index. Think of an alias as a simple way to _alias_ an index with a  
different name, possibly adding the ability to automatically apply a filter  
and routing when searching / indexing.

On Thu, Nov 3, 2011 at 9:32 PM, ajay padvi [ajaypadvi@gmail.com](mailto:ajaypadvi@gmail.com) wrote:

> Hi shay;
> 
> Thanks for your reply.I disabled the source at mapping and getting  
> appropriate results in search DSLs,But my requirement is to create a view  
> like structure/alias on index so that i can specify those field to be shown  
> during an alias creation time only like we do in SQLs views.But as far as i  
> have observed an alias only supports filter and i was not able to specify  
> wanted fields to be retrieved by any means in alias "add" action.  
> The problem is related to database search where in where in i want to  
> specify only those columns mapped according to privileges.
> 
> Please share and provide me some inputs whether can it be done in  
> elasticsearch or not for which i will be very obliged.
> 
> Thnks;  
> Arien.
> 
> On Thu, Nov 3, 2011 at 11:12 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > Disabling the source is done on the mapping side. When you create an  
> > index, you can have mappings for types, on them, you can disable storing  
> > the source.
> > 
> > On the search side, even if \_source is stored, you can set "fields" to an  
> > empty array, in which case the response will not include any fields (except  
> > for the id).
> > 
> > On Thu, Nov 3, 2011 at 7:50 AM, arien [ajaypadvi@gmail.com](mailto:ajaypadvi@gmail.com) wrote:
> > 
> > > Hi;
> > > 
> > > I am retriving documents using source disabled as follows
> > > 
> > > {  
> > > "fields": ,  
> > > "\_source": {  
> > > "enabled": false  
> > > },  
> > > "query": {  
> > > "term": {  
> > > "usersonmail": "ajay.padvi"  
> > > }  
> > > }  
> > > }  
> > > but still its showing me all the columns.Please someone clarify how to  
> > > achieve retrieval of only wanted columns from an alias.
> > > 
> > > Thnks
> > > 
> > > On Nov 3, 10:09 am, arien [ajaypa...@gmail.com](mailto:ajaypa...@gmail.com) wrote:
> > > 
> > > > Hi;  
> > > > I have some small doubt regarding making an alias on 2 or 3 indexes  
> > > > that whether or not fields of your choice can be included while making  
> > > > an alias on individual index like we do in Database views.  
> > > > Thanks;

---

<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:49am UTC](https://discuss.elastic.co/t/inclusion-of-fields-while-creating-an-aliases/5754/6 "2017-07-06T03:49:43Z")

</div>


