# Setting term separators, analyzers with java api

**URL:** https://discuss.elastic.co/t/setting-term-separators-analyzers-with-java-api/7806
**Category:** Elasticsearch
**Created:** [May 22, 2012, 2:05pm UTC](https://discuss.elastic.co/t/setting-term-separators-analyzers-with-java-api/7806 "2012-05-22T14:05:44Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![feridcelik](https://avatars.discourse-cdn.com/v4/letter/f/3ab097/32.png) [@feridcelik](https://discuss.elastic.co/u/feridcelik)
#### Post date: [May 22, 2012, 2:05pm UTC](https://discuss.elastic.co/t/setting-term-separators-analyzers-with-java-api/7806/1 "2012-05-22T14:05:44Z")

</div>

Hi,

Im unable to get facets as I expected.  
We store products on ES, products got tags like 'body', 'sneakers', 't-shirt', ext..

When i get term facets on the "tag" field, "t-shirt" tag separated into two terms because of '-' character.

How do i disable these separators?  
I tried to set different analyzers but couldnt accomplish.

We are using ES 0.19.3

Thanks.

---

<div class="post-metadata">

### Author: ![Michael\_Sick](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Michael\_Sick](https://discuss.elastic.co/u/Michael_Sick)
#### Post date: [May 22, 2012, 3:27pm UTC](https://discuss.elastic.co/t/setting-term-separators-analyzers-with-java-api/7806/2 "2012-05-22T15:27:19Z")

</div>

set the mapping for the field to not\_analyzed, something like:

```
            "foo-field" : { "type" : "string", "index" :

```

"not\_analyzed", "store" : "yes", "include\_in\_all" : true},

If you need both analyzed and not analyzed versions, see the multi\_field  
option.

--Mike

On Tue, May 22, 2012 at 10:05 AM, feridcelik [feridcelik@gmail.com](mailto:feridcelik@gmail.com) wrote:

> Hi,
> 
> Im unable to get facets as I expected.  
> We store products on ES, products got tags like 'body', 'sneakers',  
> 't-shirt', ext..
> 
> When i get term facets on the "tag" field, "t-shirt" tag separated into two  
> terms because of '-' character.
> 
> How do i disable these separators?  
> I tried to set different analyzers but couldnt accomplish.
> 
> We are using ES 0.19.3
> 
> Thanks.
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715.html](http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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: [May 25, 2012, 8:26pm UTC](https://discuss.elastic.co/t/setting-term-separators-analyzers-with-java-api/7806/3 "2012-05-25T20:26:56Z")

</div>

Note that store set to yes is not really needed.

On Tue, May 22, 2012 at 5:27 PM, Michael Sick \<  
[michael.sick@serenesoftware.com](mailto:michael.sick@serenesoftware.com)\> wrote:

> set the mapping for the field to not\_analyzed, something like:
> 
> ```
> "foo-field" : { "type" : "string", "index" :
> 
> ```
> 
> "not\_analyzed", "store" : "yes", "include\_in\_all" : true},
> 
> If you need both analyzed and not analyzed versions, see the multi\_field  
> option.
> 
> --Mike
> 
> On Tue, May 22, 2012 at 10:05 AM, feridcelik [feridcelik@gmail.com](mailto:feridcelik@gmail.com) wrote:
> 
> > Hi,
> > 
> > Im unable to get facets as I expected.  
> > We store products on ES, products got tags like 'body', 'sneakers',  
> > 't-shirt', ext..
> > 
> > When i get term facets on the "tag" field, "t-shirt" tag separated into  
> > two  
> > terms because of '-' character.
> > 
> > How do i disable these separators?  
> > I tried to set different analyzers but couldnt accomplish.
> > 
> > We are using ES 0.19.3
> > 
> > Thanks.
> > 
> > --  
> > View this message in context:  
> > [http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715.html](http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715.html)  
> > Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

### Author: ![feridcelik](https://avatars.discourse-cdn.com/v4/letter/f/3ab097/32.png) [@feridcelik](https://discuss.elastic.co/u/feridcelik)
#### Post date: [May 26, 2012, 12:27pm UTC](https://discuss.elastic.co/t/setting-term-separators-analyzers-with-java-api/7806/4 "2012-05-26T12:27:53Z")

</div>

Thanks guys, i set that field as "not\_analyzed" and facet results are based  
on actual field values.

Now i got more questions 🙂

- Does that "not\_analyzed" thing affect search results ?

- My documents are quite small (~10 fields and small values) and i need  
most of the fields loaded on search results. Do i need to set  
{"store":"yes"} for better performance?

Thanks.

Ferid Gürbüz

On Fri, May 25, 2012 at 11:27 PM, kimchy [via Elasticsearch Users] \<  
[ml-node+s115913n4015870h55@n3.nabble.com](mailto:ml-node+s115913n4015870h55@n3.nabble.com)\> wrote:

> Note that store set to yes is not really needed.
> 
> On Tue, May 22, 2012 at 5:27 PM, Michael Sick \<[hidden email][http://user/SendEmail.jtp?type=node&node=4015870&i=0](http://user/SendEmail.jtp?type=node&node=4015870&i=0)
> 
> > wrote:
> 
> > set the mapping for the field to not\_analyzed, something like:
> > 
> > ```
> > "foo-field" : { "type" : "string", "index" :
> > 
> > ```
> > 
> > "not\_analyzed", "store" : "yes", "include\_in\_all" : true},
> > 
> > If you need both analyzed and not analyzed versions, see the multi\_field  
> > option.
> > 
> > --Mike
> > 
> > On Tue, May 22, 2012 at 10:05 AM, feridcelik \<[hidden email][http://user/SendEmail.jtp?type=node&node=4015870&i=1](http://user/SendEmail.jtp?type=node&node=4015870&i=1)
> > 
> > > wrote:
> > 
> > > Hi,
> > > 
> > > Im unable to get facets as I expected.  
> > > We store products on ES, products got tags like 'body', 'sneakers',  
> > > 't-shirt', ext..
> > > 
> > > When i get term facets on the "tag" field, "t-shirt" tag separated into  
> > > two  
> > > terms because of '-' character.
> > > 
> > > How do i disable these separators?  
> > > I tried to set different analyzers but couldnt accomplish.
> > > 
> > > We are using ES 0.19.3
> > > 
> > > Thanks.
> > > 
> > > --  
> > > View this message in context:  
> > > [http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715.html](http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715.html)  
> > > Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).
> 
> * * *
> 
> If you reply to this email, your message will be added to the discussion  
> below:
> 
> [http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715p4015870.html](http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715p4015870.html)  
> To unsubscribe from Setting term separators, analyzers with java api, click  
> here[http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe\_by\_code&node=4006715&code=ZmVyaWRjZWxpa0BnbWFpbC5jb218NDAwNjcxNXwtMTM2NjM5OTEyMw==](http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4006715&code=ZmVyaWRjZWxpa0BnbWFpbC5jb218NDAwNjcxNXwtMTM2NjM5OTEyMw==)  
> .  
> NAML[http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=macro\_viewer&id=instant\_html!nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify\_subscribers!nabble%3Aemail.naml-instant\_emails!nabble%3Aemail.naml-send\_instant\_email!nabble%3Aemail.naml](http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml)

---

<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: [May 30, 2012, 8:56am UTC](https://discuss.elastic.co/t/setting-term-separators-analyzers-with-java-api/7806/5 "2012-05-30T08:56:35Z")

</div>

No, you don't need store to be set to yes for better performance, since it  
plays no part when searching, only when loading a relevant hit to be  
returned to the user (and if a field is not explicitly stored, it will be  
fetched from \_source).

On Sat, May 26, 2012 at 2:28 PM, feridcelik [feridcelik@gmail.com](mailto:feridcelik@gmail.com) wrote:

> Thanks guys, i set that field as "not\_analyzed" and facet results are  
> based on actual field values.
> 
> Now i got more questions 🙂
> 
> - Does that "not\_analyzed" thing affect search results ?
> 
> - My documents are quite small (~10 fields and small values) and i need  
> most of the fields loaded on search results. Do i need to set  
> {"store":"yes"} for better performance?
> 
> Thanks.
> 
> Ferid Gürbüz
> 
> On Fri, May 25, 2012 at 11:27 PM, kimchy [via Elasticsearch Users] \<[hidden  
> email] [http://user/SendEmail.jtp?type=node&node=4016604&i=0](http://user/SendEmail.jtp?type=node&node=4016604&i=0)\> wrote:
> 
> > Note that store set to yes is not really needed.
> > 
> > On Tue, May 22, 2012 at 5:27 PM, Michael Sick \<[hidden email][http://user/SendEmail.jtp?type=node&node=4015870&i=0](http://user/SendEmail.jtp?type=node&node=4015870&i=0)
> > 
> > > wrote:
> > 
> > > set the mapping for the field to not\_analyzed, something like:
> > > 
> > > ```
> > > "foo-field" : { "type" : "string", "index" :
> > > 
> > > ```
> > > 
> > > "not\_analyzed", "store" : "yes", "include\_in\_all" : true},
> > > 
> > > If you need both analyzed and not analyzed versions, see the multi\_field  
> > > option.
> > > 
> > > --Mike
> > > 
> > > On Tue, May 22, 2012 at 10:05 AM, feridcelik \<[hidden email][http://user/SendEmail.jtp?type=node&node=4015870&i=1](http://user/SendEmail.jtp?type=node&node=4015870&i=1)
> > > 
> > > > wrote:
> > > 
> > > > Hi,
> > > > 
> > > > Im unable to get facets as I expected.  
> > > > We store products on ES, products got tags like 'body', 'sneakers',  
> > > > 't-shirt', ext..
> > > > 
> > > > When i get term facets on the "tag" field, "t-shirt" tag separated into  
> > > > two  
> > > > terms because of '-' character.
> > > > 
> > > > How do i disable these separators?  
> > > > I tried to set different analyzers but couldnt accomplish.
> > > > 
> > > > We are using ES 0.19.3
> > > > 
> > > > Thanks.
> > > > 
> > > > --  
> > > > View this message in context:  
> > > > [http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715.html](http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715.html)  
> > > > Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).
> > 
> > * * *
> > 
> > If you reply to this email, your message will be added to the  
> > discussion below:
> > 
> > [http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715p4015870.html](http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715p4015870.html)  
> > To unsubscribe from Setting term separators, analyzers with java api, click  
> > here.  
> > NAML[http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=macro\_viewer&id=instant\_html!nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify\_subscribers!nabble%3Aemail.naml-instant\_emails!nabble%3Aemail.naml-send\_instant\_email!nabble%3Aemail.naml](http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml)
> 
> * * *
> 
> View this message in context: Re: Setting term separators, analyzers with  
> java api[http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715p4016604.html](http://elasticsearch-users.115913.n3.nabble.com/Setting-term-separators-analyzers-with-java-api-tp4006715p4016604.html)
> 
> Sent from the Elasticsearch Users mailing list archive[http://elasticsearch-users.115913.n3.nabble.com/](http://elasticsearch-users.115913.n3.nabble.com/)at [Nabble.com](http://Nabble.com).

---

<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:26am UTC](https://discuss.elastic.co/t/setting-term-separators-analyzers-with-java-api/7806/6 "2017-07-06T03:26:19Z")

</div>


