# Dash in facet field

**URL:** <https://discuss.elastic.co/t/dash-in-facet-field/6114>\
**Category:** Elasticsearch\
**Created:** [December 10, 2011, 5:05am UTC](https://discuss.elastic.co/t/dash-in-facet-field/6114 "2011-12-10T05:05:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrik\_Votocek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrik_votocek/32/2027_2.png) [@Patrik\_Votocek](https://discuss.elastic.co/u/Patrik_Votocek)\
**Post date:** [December 10, 2011, 5:05am UTC](https://discuss.elastic.co/t/dash-in-facet-field/6114/1 "2011-12-10T05:05:18Z")

</div>

Hi,

i have problem with facets. I have documents with user field. In  
documents is user "vrtak-cz". I use this field as facet (field term).

ES split this user in facets to 1. "vrtak" 2. "cz"

example data  
[https://gist.github.com/9bd1e1bc4bf289a576cc](https://gist.github.com/9bd1e1bc4bf289a576cc)

---

<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:** [December 10, 2011, 7:41am UTC](https://discuss.elastic.co/t/dash-in-facet-field/6114/2 "2011-12-10T07:41:10Z")

</div>

Define a mapping for this field.  
I use a keyword analyzer for the same use case.

HTH  
David 😉  
@dadoonet

Le 10 déc. 2011 à 06:05, Patrik Votoček [patrik@votocek.cz](mailto:patrik@votocek.cz) a écrit :

> Hi,
> 
> i have problem with facets. I have documents with user field. In  
> documents is user "vrtak-cz". I use this field as facet (field term).
> 
> ES split this user in facets to 1. "vrtak" 2. "cz"
> 
> example data  
> [https://gist.github.com/9bd1e1bc4bf289a576cc](https://gist.github.com/9bd1e1bc4bf289a576cc)

---

<div class="post-metadata">

**Author:** ![Patrik\_Votocek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrik_votocek/32/2027_2.png) [@Patrik\_Votocek](https://discuss.elastic.co/u/Patrik_Votocek)\
**Post date:** [December 11, 2011, 4:23am UTC](https://discuss.elastic.co/t/dash-in-facet-field/6114/3 "2011-12-11T04:23:58Z")

</div>

I'm newbe in ES world.

So how do i setup differend mapping for this field? How to say use whole  
string?

---

<div class="post-metadata">

**Author:** ![Patrik\_Votocek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrik_votocek/32/2027_2.png) [@Patrik\_Votocek](https://discuss.elastic.co/u/Patrik_Votocek)\
**Post date:** [December 11, 2011, 4:54am UTC](https://discuss.elastic.co/t/dash-in-facet-field/6114/4 "2011-12-11T04:54:02Z")

</div>

I found it 🙂

[https://gist.github.com/9bd1e1bc4bf289a576cc#file\_solution.json](https://gist.github.com/9bd1e1bc4bf289a576cc#file_solution.json)

So is it possible set mapping after documents in index?

---

<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:** [December 11, 2011, 6:53am UTC](https://discuss.elastic.co/t/dash-in-facet-field/6114/5 "2011-12-11T06:53:11Z")

</div>

No. You have to define the mapping for a document type before you send the first doc.

Hth  
David 😉  
@dadoonet

Le 11 déc. 2011 à 05:54, Patrik Votoček [patrik@votocek.cz](mailto:patrik@votocek.cz) a écrit :

> I found it 🙂
> 
> [https://gist.github.com/9bd1e1bc4bf289a576cc#file\_solution.json](https://gist.github.com/9bd1e1bc4bf289a576cc#file_solution.json)
> 
> So is it possible set mapping after documents in index?

---

<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:** [December 12, 2011, 12:52pm UTC](https://discuss.elastic.co/t/dash-in-facet-field/6114/6 "2011-12-12T12:52:45Z")

</div>

Another possibly simpler solution is just to mark the field in the mapping  
with index set to not\_analyzed (which is the same as using keyword  
analyzed). Note, in the same, make sure the _analyzer_ is set to that, not  
just the index\_analyzer. And as David pointed out, you will have to set the  
mapping when you create the index, and then index the data.

On Sun, Dec 11, 2011 at 8:53 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> No. You have to define the mapping for a document type before you send the  
> first doc.
> 
> Hth  
> David 😉  
> @dadoonet
> 
> Le 11 déc. 2011 à 05:54, Patrik Votoček [patrik@votocek.cz](mailto:patrik@votocek.cz) a écrit :
> 
> > I found it 🙂
> > 
> > [https://gist.github.com/9bd1e1bc4bf289a576cc#file\_solution.json](https://gist.github.com/9bd1e1bc4bf289a576cc#file_solution.json)
> > 
> > So is it possible set mapping after documents in index?

---

<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:45am UTC](https://discuss.elastic.co/t/dash-in-facet-field/6114/7 "2017-07-06T03:45:42Z")

</div>

Closed on July 6, 2017, 3:45am UTC


