# Mapping configuration

**URL:** <https://discuss.elastic.co/t/mapping-configuration/4961>\
**Category:** Elasticsearch\
**Created:** [July 26, 2011, 7:31am UTC](https://discuss.elastic.co/t/mapping-configuration/4961 "2011-07-26T07:31:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![OlgaT](https://avatars.discourse-cdn.com/v4/letter/o/fbc32d/32.png) [@OlgaT](https://discuss.elastic.co/u/OlgaT)\
**Post date:** [July 26, 2011, 7:31am UTC](https://discuss.elastic.co/t/mapping-configuration/4961/1 "2011-07-26T07:31:14Z")

</div>

Hi,

I would like to map two (or more ) properties to one common field.  
Also I would like to map the same properties several fields.  
For example:  
class A {  
String a;  
String b;  
String c;  
}

I would like that

- property"a" will be mapped to field "a" and field "commonField"
- property"b" will be mapped to field "b" and field "commonField"
- property"c" will be mapped to field "c"

Do I have this possibility in elastic search?  
Thanks,  
Olga

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 26, 2011, 12:03pm UTC](https://discuss.elastic.co/t/mapping-configuration/4961/2 "2011-07-26T12:03:01Z")

</div>

You need to do that yourself by creating a common field. Another option is  
the \_all field which by default includes all fields, but you can exclude  
some from it using the mapping.

This can be a feature in elasticsearch, for users to define "custom" \_all  
fields, that will include only specific fields. Shouldn't be too difficult  
to implement...

On Tue, Jul 26, 2011 at 10:31 AM, OlgaT [tubmano@gmail.com](mailto:tubmano@gmail.com) wrote:

> Hi,
> 
> I would like to map two (or more ) properties to one common field.  
> Also I would like to map the same properties several fields.  
> For example:  
> class A {  
> String a;  
> String b;  
> String c;  
> }
> 
> I would like that
> 
> - property"a" will be mapped to field "a" and field "commonField"
> - property"b" will be mapped to field "b" and field "commonField"
> - property"c" will be mapped to field "c"
> 
> Do I have this possibility in Elasticsearch?  
> Thanks,  
> Olga

---

<div class="post-metadata">

**Author:** ![OlgaT](https://avatars.discourse-cdn.com/v4/letter/o/fbc32d/32.png) [@OlgaT](https://discuss.elastic.co/u/OlgaT)\
**Post date:** [July 26, 2011, 2:13pm UTC](https://discuss.elastic.co/t/mapping-configuration/4961/3 "2011-07-26T14:13:30Z")

</div>

Hi Shay,

Are you going to implement this feature? If yes, then when.  
We need it.

Thanks,  
Olga

On Tue, Jul 26, 2011 at 3:03 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> You need to do that yourself by creating a common field. Another option is  
> the \_all field which by default includes all fields, but you can exclude  
> some from it using the mapping.
> 
> This can be a feature in elasticsearch, for users to define "custom" \_all  
> fields, that will include only specific fields. Shouldn't be too difficult  
> to implement...
> 
> On Tue, Jul 26, 2011 at 10:31 AM, OlgaT [tubmano@gmail.com](mailto:tubmano@gmail.com) wrote:
> 
> > Hi,
> > 
> > I would like to map two (or more ) properties to one common field.  
> > Also I would like to map the same properties several fields.  
> > For example:  
> > class A {  
> > String a;  
> > String b;  
> > String c;  
> > }
> > 
> > I would like that
> > 
> > - property"a" will be mapped to field "a" and field "commonField"
> > - property"b" will be mapped to field "b" and field "commonField"
> > - property"c" will be mapped to field "c"
> > 
> > Do I have this possibility in Elasticsearch?  
> > Thanks,  
> > Olga

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 26, 2011, 2:19pm UTC](https://discuss.elastic.co/t/mapping-configuration/4961/4 "2011-07-26T14:19:55Z")

</div>

Open an issue for it.

On Tue, Jul 26, 2011 at 5:13 PM, Olga Tubman [tubmano@gmail.com](mailto:tubmano@gmail.com) wrote:

> Hi Shay,
> 
> Are you going to implement this feature? If yes, then when.  
> We need it.
> 
> Thanks,  
> Olga
> 
> On Tue, Jul 26, 2011 at 3:03 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:
> 
> > You need to do that yourself by creating a common field. Another option is  
> > the \_all field which by default includes all fields, but you can exclude  
> > some from it using the mapping.
> > 
> > This can be a feature in elasticsearch, for users to define "custom" \_all  
> > fields, that will include only specific fields. Shouldn't be too difficult  
> > to implement...
> > 
> > On Tue, Jul 26, 2011 at 10:31 AM, OlgaT [tubmano@gmail.com](mailto:tubmano@gmail.com) wrote:
> > 
> > > Hi,
> > > 
> > > I would like to map two (or more ) properties to one common field.  
> > > Also I would like to map the same properties several fields.  
> > > For example:  
> > > class A {  
> > > String a;  
> > > String b;  
> > > String c;  
> > > }
> > > 
> > > I would like that
> > > 
> > > - property"a" will be mapped to field "a" and field "commonField"
> > > - property"b" will be mapped to field "b" and field "commonField"
> > > - property"c" will be mapped to field "c"
> > > 
> > > Do I have this possibility in Elasticsearch?  
> > > Thanks,  
> > > Olga

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 27, 2011, 9:13am UTC](https://discuss.elastic.co/t/mapping-configuration/4961/5 "2011-07-27T09:13:33Z")

</div>

It is possible to have a "combo" field that will use the specific analyzers  
associated with the fields forming that "combo" field, but, the problem with  
that is which analyzer will you use when you search on that field?

On Wed, Jul 27, 2011 at 12:05 PM, Olivier Favre [olivier@yakaz.com](mailto:olivier@yakaz.com) wrote:

> It is interesting to automatically create a (possibly) multi-valued common  
> field from multiple fields.  
> But how would you like to search against it in the case the original and  
> common fields have different analyzers?
> 
> If it works alike \_all, the values would be re-analyzed using the common  
> field's settings and you may lack useful advanced analysis you've  
> configured.
> 
> I would personally like something else: Merging the analyzed terms (cached  
> TokenStreams) from the original fields. Thus, any advanced configuration  
> would not be lost, and searching could be performed with any correct  
> analyzer, maybe using a combination of those (see  
> [Merging the terms from multiple sub-analyzers · Issue #1128 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1128)).
> 
> This (merging the tokens more than the values), would also be very useful  
> for us.  
> I'll open an issue for it.
> 
> --  
> Olivier Favre
> 
> [www.yakaz.com](http://www.yakaz.com)
> 
> 2011/7/26 Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)
> 
> > Open an issue for it.
> > 
> > On Tue, Jul 26, 2011 at 5:13 PM, Olga Tubman [tubmano@gmail.com](mailto:tubmano@gmail.com) wrote:
> > 
> > > Hi Shay,
> > > 
> > > Are you going to implement this feature? If yes, then when.  
> > > We need it.
> > > 
> > > Thanks,  
> > > Olga
> > > 
> > > On Tue, Jul 26, 2011 at 3:03 PM, Shay Banon \<  
> > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)\> wrote:
> > > 
> > > > You need to do that yourself by creating a common field. Another option  
> > > > is the \_all field which by default includes all fields, but you can exclude  
> > > > some from it using the mapping.
> > > > 
> > > > This can be a feature in elasticsearch, for users to define "custom"  
> > > > \_all fields, that will include only specific fields. Shouldn't be too  
> > > > difficult to implement...
> > > > 
> > > > On Tue, Jul 26, 2011 at 10:31 AM, OlgaT [tubmano@gmail.com](mailto:tubmano@gmail.com) wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > I would like to map two (or more ) properties to one common field.  
> > > > > Also I would like to map the same properties several fields.  
> > > > > For example:  
> > > > > class A {  
> > > > > String a;  
> > > > > String b;  
> > > > > String c;  
> > > > > }
> > > > > 
> > > > > I would like that
> > > > > 
> > > > > - property"a" will be mapped to field "a" and field "commonField"
> > > > > - property"b" will be mapped to field "b" and field "commonField"
> > > > > - property"c" will be mapped to field "c"
> > > > > 
> > > > > Do I have this possibility in Elasticsearch?  
> > > > > Thanks,  
> > > > > Olga

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 27, 2011, 9:39am UTC](https://discuss.elastic.co/t/mapping-configuration/4961/6 "2011-07-27T09:39:23Z")

</div>

Yea, but that creates a complicated integration point, as queries need to  
know about the analyzers and possibly create OR clauses for example, or  
maybe dis max, or something else...

What I meant by my comments is that this feature is quite complex in terms  
of trying and make it usable.

On Wed, Jul 27, 2011 at 12:27 PM, Olivier Favre [olivier@yakaz.com](mailto:olivier@yakaz.com) wrote:

> Either original analyzer would yield results.  
> But you can also use the same combo analyzer (well, another especially  
> created in the configuration to match the same analyzers from the original  
> fields), using an OR operator, or a text\_phrase query (mapping to  
> MultiPhraseQuery).
> 
> ## I've been successfully using the combo analyzer using "simple" and "english" during indexing, and another using "simple" and, say, "french" during search.
> 
> Olivier Favre
> 
> [www.yakaz.com](http://www.yakaz.com)
> 
> 2011/7/27 Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com)
> 
> > It is possible to have a "combo" field that will use the specific  
> > analyzers associated with the fields forming that "combo" field, but, the  
> > problem with that is which analyzer will you use when you search on that  
> > field?
> > 
> > On Wed, Jul 27, 2011 at 12:05 PM, Olivier Favre [olivier@yakaz.com](mailto:olivier@yakaz.com)wrote:
> > 
> > > It is interesting to automatically create a (possibly) multi-valued  
> > > common field from multiple fields.  
> > > But how would you like to search against it in the case the original and  
> > > common fields have different analyzers?
> > > 
> > > If it works alike \_all, the values would be re-analyzed using the common  
> > > field's settings and you may lack useful advanced analysis you've  
> > > configured.
> > > 
> > > I would personally like something else: Merging the analyzed terms  
> > > (cached TokenStreams) from the original fields. Thus, any advanced  
> > > configuration would not be lost, and searching could be performed with any  
> > > correct analyzer, maybe using a combination of those (see  
> > > [Merging the terms from multiple sub-analyzers · Issue #1128 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1128)).
> > > 
> > > This (merging the tokens more than the values), would also be very useful  
> > > for us.  
> > > I'll open an issue for it.
> > > 
> > > --  
> > > Olivier Favre
> > > 
> > > [www.yakaz.com](http://www.yakaz.com)
> > > 
> > > 2011/7/26 Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)
> > > 
> > > > Open an issue for it.
> > > > 
> > > > On Tue, Jul 26, 2011 at 5:13 PM, Olga Tubman [tubmano@gmail.com](mailto:tubmano@gmail.com) wrote:
> > > > 
> > > > > Hi Shay,
> > > > > 
> > > > > Are you going to implement this feature? If yes, then when.  
> > > > > We need it.
> > > > > 
> > > > > Thanks,  
> > > > > Olga
> > > > > 
> > > > > On Tue, Jul 26, 2011 at 3:03 PM, Shay Banon \<  
> > > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)\> wrote:
> > > > > 
> > > > > > You need to do that yourself by creating a common field. Another  
> > > > > > option is the \_all field which by default includes all fields, but you can  
> > > > > > exclude some from it using the mapping.
> > > > > > 
> > > > > > This can be a feature in elasticsearch, for users to define "custom"  
> > > > > > \_all fields, that will include only specific fields. Shouldn't be too  
> > > > > > difficult to implement...
> > > > > > 
> > > > > > On Tue, Jul 26, 2011 at 10:31 AM, OlgaT [tubmano@gmail.com](mailto:tubmano@gmail.com) wrote:
> > > > > > 
> > > > > > > Hi,
> > > > > > > 
> > > > > > > I would like to map two (or more ) properties to one common field.  
> > > > > > > Also I would like to map the same properties several fields.  
> > > > > > > For example:  
> > > > > > > class A {  
> > > > > > > String a;  
> > > > > > > String b;  
> > > > > > > String c;  
> > > > > > > }
> > > > > > > 
> > > > > > > I would like that
> > > > > > > 
> > > > > > > - property"a" will be mapped to field "a" and field "commonField"
> > > > > > > - property"b" will be mapped to field "b" and field "commonField"
> > > > > > > - property"c" will be mapped to field "c"
> > > > > > > 
> > > > > > > Do I have this possibility in Elasticsearch?  
> > > > > > > Thanks,  
> > > > > > > Olga

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 27, 2011, 10:12am UTC](https://discuss.elastic.co/t/mapping-configuration/4961/7 "2011-07-27T10:12:34Z")

</div>

On Wed, Jul 27, 2011 at 12:46 PM, Olivier Favre [olivier@yakaz.com](mailto:olivier@yakaz.com) wrote:

> What is the cost of searching against multiple fields' indexes, compared to  
> searching to one "merged" field index?

Depends on the query you generate, but it will be slower. Besides, you can  
do it now by executing queries against different fields using the same  
search request, the search will use the relevant analyzer defined on that  
field.

> Even with no integration for search time, providing a combined field will  
> surely be beneficial to some people.

Not really, you need to think about the search aspect as well. Combined  
fields, with different analyzers, are not a common requirement (for me),  
especially since you can solve it using the above mentioned way.

> --  
> Olivier Favre
> 
> [www.yakaz.com](http://www.yakaz.com)
> 
> 2011/7/27 Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com)
> 
> > Yea, but that creates a complicated integration point, as queries need to  
> > know about the analyzers and possibly create OR clauses for example, or  
> > maybe dis max, or something else...
> > 
> > What I meant by my comments is that this feature is quite complex in terms  
> > of trying and make it usable.
> > 
> > On Wed, Jul 27, 2011 at 12:27 PM, Olivier Favre [olivier@yakaz.com](mailto:olivier@yakaz.com)wrote:
> > 
> > > Either original analyzer would yield results.  
> > > But you can also use the same combo analyzer (well, another especially  
> > > created in the configuration to match the same analyzers from the original  
> > > fields), using an OR operator, or a text\_phrase query (mapping to  
> > > MultiPhraseQuery).
> > > 
> > > ## I've been successfully using the combo analyzer using "simple" and "english" during indexing, and another using "simple" and, say, "french" during search.
> > > 
> > > Olivier Favre
> > > 
> > > [www.yakaz.com](http://www.yakaz.com)
> > > 
> > > 2011/7/27 Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com)
> > > 
> > > > It is possible to have a "combo" field that will use the specific  
> > > > analyzers associated with the fields forming that "combo" field, but, the  
> > > > problem with that is which analyzer will you use when you search on that  
> > > > field?
> > > > 
> > > > On Wed, Jul 27, 2011 at 12:05 PM, Olivier Favre [olivier@yakaz.com](mailto:olivier@yakaz.com)wrote:
> > > > 
> > > > > It is interesting to automatically create a (possibly) multi-valued  
> > > > > common field from multiple fields.  
> > > > > But how would you like to search against it in the case the original  
> > > > > and common fields have different analyzers?
> > > > > 
> > > > > If it works alike \_all, the values would be re-analyzed using the  
> > > > > common field's settings and you may lack useful advanced analysis you've  
> > > > > configured.
> > > > > 
> > > > > I would personally like something else: Merging the analyzed terms  
> > > > > (cached TokenStreams) from the original fields. Thus, any advanced  
> > > > > configuration would not be lost, and searching could be performed with any  
> > > > > correct analyzer, maybe using a combination of those (see  
> > > > > [Merging the terms from multiple sub-analyzers · Issue #1128 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1128)).
> > > > > 
> > > > > This (merging the tokens more than the values), would also be very  
> > > > > useful for us.  
> > > > > I'll open an issue for it.
> > > > > 
> > > > > --  
> > > > > Olivier Favre
> > > > > 
> > > > > [www.yakaz.com](http://www.yakaz.com)
> > > > > 
> > > > > 2011/7/26 Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)
> > > > > 
> > > > > > Open an issue for it.
> > > > > > 
> > > > > > On Tue, Jul 26, 2011 at 5:13 PM, Olga Tubman [tubmano@gmail.com](mailto:tubmano@gmail.com)wrote:
> > > > > > 
> > > > > > > Hi Shay,
> > > > > > > 
> > > > > > > Are you going to implement this feature? If yes, then when.  
> > > > > > > We need it.
> > > > > > > 
> > > > > > > Thanks,  
> > > > > > > Olga
> > > > > > > 
> > > > > > > On Tue, Jul 26, 2011 at 3:03 PM, Shay Banon \<  
> > > > > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)\> wrote:
> > > > > > > 
> > > > > > > > You need to do that yourself by creating a common field. Another  
> > > > > > > > option is the \_all field which by default includes all fields, but you can  
> > > > > > > > exclude some from it using the mapping.
> > > > > > > > 
> > > > > > > > This can be a feature in elasticsearch, for users to define "custom"  
> > > > > > > > \_all fields, that will include only specific fields. Shouldn't be too  
> > > > > > > > difficult to implement...
> > > > > > > > 
> > > > > > > > On Tue, Jul 26, 2011 at 10:31 AM, OlgaT [tubmano@gmail.com](mailto:tubmano@gmail.com) wrote:
> > > > > > > > 
> > > > > > > > > Hi,
> > > > > > > > > 
> > > > > > > > > I would like to map two (or more ) properties to one common field.  
> > > > > > > > > Also I would like to map the same properties several fields.  
> > > > > > > > > For example:  
> > > > > > > > > class A {  
> > > > > > > > > String a;  
> > > > > > > > > String b;  
> > > > > > > > > String c;  
> > > > > > > > > }
> > > > > > > > > 
> > > > > > > > > I would like that
> > > > > > > > > 
> > > > > > > > > - property"a" will be mapped to field "a" and field  
> > > > > > > > > "commonField"
> > > > > > > > > - property"b" will be mapped to field "b" and field  
> > > > > > > > > "commonField"
> > > > > > > > > - property"c" will be mapped to field "c"
> > > > > > > > > 
> > > > > > > > > Do I have this possibility in Elasticsearch?  
> > > > > > > > > Thanks,  
> > > > > > > > > Olga

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:59am UTC](https://discuss.elastic.co/t/mapping-configuration/4961/8 "2017-07-06T03:59:04Z")

</div>


