# Overriding analyzer in term filter

**URL:** <https://discuss.elastic.co/t/overriding-analyzer-in-term-filter/12412>\
**Category:** Elasticsearch\
**Created:** [June 14, 2013, 6:05am UTC](https://discuss.elastic.co/t/overriding-analyzer-in-term-filter/12412 "2013-06-14T06:05:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allan\_Johns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/allan_johns/32/2387_2.png) [@Allan\_Johns](https://discuss.elastic.co/u/Allan_Johns)\
**Post date:** [June 14, 2013, 6:05am UTC](https://discuss.elastic.co/t/overriding-analyzer-in-term-filter/12412/1 "2013-06-14T06:05:09Z")

</div>

Is this possible?

I have an analyzer using a path hierarchy tokenizer that I use on a  
particular field. This works fine, but sometimes I want to do an  
exact-match on the field. I can't quite work out how to get this working  
though.

Thanks  
A

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Erik\_Fassler\_2](https://avatars.discourse-cdn.com/v4/letter/e/9fc29f/32.png) [@Erik\_Fassler\_2](https://discuss.elastic.co/u/Erik_Fassler_2)\
**Post date:** [June 14, 2013, 10:49am UTC](https://discuss.elastic.co/t/overriding-analyzer-in-term-filter/12412/2 "2013-06-14T10:49:34Z")

</div>

I'm not sure I exactly understood the question.  
What does not work as desired? You can do term queries  
([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/term-query/)) which  
should be "exact-match", if this is what you mean?

On Friday, 14 June 2013 08:05:09 UTC+2, Allan Johns wrote:

> Is this possible?
> 
> I have an analyzer using a path hierarchy tokenizer that I use on a  
> particular field. This works fine, but sometimes I want to do an  
> exact-match on the field. I can't quite work out how to get this working  
> though.
> 
> Thanks  
> A

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [June 14, 2013, 7:37pm UTC](https://discuss.elastic.co/t/overriding-analyzer-in-term-filter/12412/3 "2013-06-14T19:37:52Z")

</div>

Try using multi field on the original field:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

One field and use an analyzer with a path hierarchy tokenizer and another  
field can be non-analyzed. The term filter should be used on non-analyzed  
fields (or with analyzers that only produce one token (lowercase,  
ascii-folding, etc..).

--  
Ivan

On Fri, Jun 14, 2013 at 3:49 AM, Erik Fäßler [khituras@gmail.com](mailto:khituras@gmail.com) wrote:

> I'm not sure I exactly understood the question.  
> What does not work as desired? You can do term queries (  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/term-query/)) which  
> should be "exact-match", if this is what you mean?
> 
> On Friday, 14 June 2013 08:05:09 UTC+2, Allan Johns wrote:
> 
> > Is this possible?
> > 
> > I have an analyzer using a path hierarchy tokenizer that I use on a  
> > particular field. This works fine, but sometimes I want to do an  
> > exact-match on the field. I can't quite work out how to get this working  
> > though.
> > 
> > Thanks  
> > A
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Allan\_Johns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/allan_johns/32/2387_2.png) [@Allan\_Johns](https://discuss.elastic.co/u/Allan_Johns)\
**Post date:** [June 14, 2013, 11:56pm UTC](https://discuss.elastic.co/t/overriding-analyzer-in-term-filter/12412/4 "2013-06-14T23:56:11Z")

</div>

Wait so I shouldn't be using a term filter in the first place? Now I'm  
confused, I didn't think you had to be concerned about the analyzer in use  
when using a term filter. What should I be using instead?

@Erik: Let's say I have a field value folder="/foo/bah/eek". Using a term  
filter works fine and returns this document when I ask for "/foo",  
"/foo/bah" or "/foo/bah/eek", which is what I want. However in one case, I  
don't want this behaviour, I want an exact match instead.

On Sat, Jun 15, 2013 at 5:37 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Try using multi field on the original field:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/multi-field-type/)
> 
> One field and use an analyzer with a path hierarchy tokenizer and another  
> field can be non-analyzed. The term filter should be used on non-analyzed  
> fields (or with analyzers that only produce one token (lowercase,  
> ascii-folding, etc..).
> 
> --  
> Ivan
> 
> On Fri, Jun 14, 2013 at 3:49 AM, Erik Fäßler [khituras@gmail.com](mailto:khituras@gmail.com) wrote:
> 
> > I'm not sure I exactly understood the question.  
> > What does not work as desired? You can do term queries (  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/term-query/))  
> > which should be "exact-match", if this is what you mean?
> > 
> > On Friday, 14 June 2013 08:05:09 UTC+2, Allan Johns wrote:
> > 
> > > Is this possible?
> > > 
> > > I have an analyzer using a path hierarchy tokenizer that I use on a  
> > > particular field. This works fine, but sometimes I want to do an  
> > > exact-match on the field. I can't quite work out how to get this working  
> > > though.
> > > 
> > > Thanks  
> > > A
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google Groups  
> > > "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Allan\_Johns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/allan_johns/32/2387_2.png) [@Allan\_Johns](https://discuss.elastic.co/u/Allan_Johns)\
**Post date:** [June 14, 2013, 11:59pm UTC](https://discuss.elastic.co/t/overriding-analyzer-in-term-filter/12412/5 "2013-06-14T23:59:39Z")

</div>

@Ivan thanks, multi field type looks like what I'm after.  
A

On Sat, Jun 15, 2013 at 9:56 AM, Allan Johns [nerdvegas@gmail.com](mailto:nerdvegas@gmail.com) wrote:

> Wait so I shouldn't be using a term filter in the first place? Now I'm  
> confused, I didn't think you had to be concerned about the analyzer in use  
> when using a term filter. What should I be using instead?
> 
> @Erik: Let's say I have a field value folder="/foo/bah/eek". Using a term  
> filter works fine and returns this document when I ask for "/foo",  
> "/foo/bah" or "/foo/bah/eek", which is what I want. However in one case, I  
> don't want this behaviour, I want an exact match instead.
> 
> On Sat, Jun 15, 2013 at 5:37 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > Try using multi field on the original field:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/multi-field-type/)
> > 
> > One field and use an analyzer with a path hierarchy tokenizer and another  
> > field can be non-analyzed. The term filter should be used on non-analyzed  
> > fields (or with analyzers that only produce one token (lowercase,  
> > ascii-folding, etc..).
> > 
> > --  
> > Ivan
> > 
> > On Fri, Jun 14, 2013 at 3:49 AM, Erik Fäßler [khituras@gmail.com](mailto:khituras@gmail.com) wrote:
> > 
> > > I'm not sure I exactly understood the question.  
> > > What does not work as desired? You can do term queries (  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/term-query/))  
> > > which should be "exact-match", if this is what you mean?
> > > 
> > > On Friday, 14 June 2013 08:05:09 UTC+2, Allan Johns wrote:
> > > 
> > > > Is this possible?
> > > > 
> > > > I have an analyzer using a path hierarchy tokenizer that I use on a  
> > > > particular field. This works fine, but sometimes I want to do an  
> > > > exact-match on the field. I can't quite work out how to get this working  
> > > > though.
> > > > 
> > > > Thanks  
> > > > A
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:31am UTC](https://discuss.elastic.co/t/overriding-analyzer-in-term-filter/12412/6 "2017-07-06T02:31:08Z")

</div>


