# Charfilter support in analysis api

**URL:** <https://discuss.elastic.co/t/charfilter-support-in-analysis-api/15859>\
**Category:** Elasticsearch\
**Created:** [February 17, 2014, 8:24pm UTC](https://discuss.elastic.co/t/charfilter-support-in-analysis-api/15859 "2014-02-17T20:24:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erdinc\_Yilmazel](https://avatars.discourse-cdn.com/v4/letter/e/e9bcb4/32.png) [@Erdinc\_Yilmazel](https://discuss.elastic.co/u/Erdinc_Yilmazel)\
**Post date:** [February 17, 2014, 8:24pm UTC](https://discuss.elastic.co/t/charfilter-support-in-analysis-api/15859/1 "2014-02-17T20:24:58Z")

</div>

Hi,

I am building a plugin for elasticsearch and I am using the java api to to  
send an analysis request. The AnalysisRequestBuilder class doesn't support  
specifying the char filters unlike the tokenizer or the token filters. The  
same thing also is true for the rest API too. Is there any plan to add this  
feature?

Since I am writing a plugin that actually is deployed on the same JVM with  
elasticsearch, is there a workaround that I can use? For instance, can I  
inject an instance of CharFilterFactory into my code for a char filter that  
is defined in my settings?

Thanks,

Erdinç

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9a78e66a-9302-4707-9acd-2c6cd73ab1af%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9a78e66a-9302-4707-9acd-2c6cd73ab1af%40googlegroups.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:** [February 17, 2014, 10:13pm UTC](https://discuss.elastic.co/t/charfilter-support-in-analysis-api/15859/2 "2014-02-17T22:13:45Z")

</div>

Since your code is running as the same JVM as Elasticsearch, you have a few  
more options. Depending on your use case, you can bypass the analysis API  
and use the analyzers directly. Look at the test code in the analysis  
package, in particular the AnalysisModuleTests class. The key is building  
the AnalysisService

[https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java](https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java)

As far as your initial request, I am not sure why AnalyzeRequest does not  
support char filters. The underlying TransportAnalyzeAction class could  
support them.

Cheers,

Ivan

On Mon, Feb 17, 2014 at 12:24 PM, Erdinc Yilmazel  
[erdincyilmazel@gmail.com](mailto:erdincyilmazel@gmail.com)wrote:

> Hi,
> 
> I am building a plugin for elasticsearch and I am using the java api to to  
> send an analysis request. The AnalysisRequestBuilder class doesn't support  
> specifying the char filters unlike the tokenizer or the token filters. The  
> same thing also is true for the rest API too. Is there any plan to add this  
> feature?
> 
> Since I am writing a plugin that actually is deployed on the same JVM with  
> elasticsearch, is there a workaround that I can use? For instance, can I  
> inject an instance of CharFilterFactory into my code for a char filter that  
> is defined in my settings?
> 
> Thanks,
> 
> Erdinç
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/9a78e66a-9302-4707-9acd-2c6cd73ab1af%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9a78e66a-9302-4707-9acd-2c6cd73ab1af%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC1LWm7f7J1foFkZH7X1A%2BxLGUghTrnbhu1kjzU02h9Ww%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC1LWm7f7J1foFkZH7X1A%2BxLGUghTrnbhu1kjzU02h9Ww%40mail.gmail.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:** [February 18, 2014, 4:32am UTC](https://discuss.elastic.co/t/charfilter-support-in-analysis-api/15859/3 "2014-02-18T04:32:46Z")

</div>

The change seemed simple, so I went ahead and implemented it:

> <https://github.com/elastic/elasticsearch/pull/5148>
>
> Allow char filters to be used in the analyze API. Potentially breaks AnalyzeRequ…est serialization. The REST action contains the now ambiguous 'filter' parameter, which will denote a 'token\_filter', not a 'char\_filter'.
> 
> One additional item I noticed is the exception message for invalid token filters. To me it appears like an overzealous copy and paste, but should the exception contain the token filter name, not the tokenizer? I can fix this item as well.
> 
> Example:
> https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/admin/indices/analyze/TransportAnalyzeAction.java?source=cc#L173

The tricky part is getting the Elasticsearch team to notice. 🙂

--  
Ivan

On Mon, Feb 17, 2014 at 2:13 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Since your code is running as the same JVM as Elasticsearch, you have a  
> few more options. Depending on your use case, you can bypass the analysis  
> API and use the analyzers directly. Look at the test code in the analysis  
> package, in particular the AnalysisModuleTests class. The key is building  
> the AnalysisService
> 
> [https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java](https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java)
> 
> As far as your initial request, I am not sure why AnalyzeRequest does not  
> support char filters. The underlying TransportAnalyzeAction class could  
> support them.
> 
> Cheers,
> 
> Ivan
> 
> On Mon, Feb 17, 2014 at 12:24 PM, Erdinc Yilmazel \<  
> [erdincyilmazel@gmail.com](mailto:erdincyilmazel@gmail.com)\> wrote:
> 
> > Hi,
> > 
> > I am building a plugin for elasticsearch and I am using the java api to  
> > to send an analysis request. The AnalysisRequestBuilder class doesn't  
> > support specifying the char filters unlike the tokenizer or the token  
> > filters. The same thing also is true for the rest API too. Is there any  
> > plan to add this feature?
> > 
> > Since I am writing a plugin that actually is deployed on the same JVM  
> > with elasticsearch, is there a workaround that I can use? For instance, can  
> > I inject an instance of CharFilterFactory into my code for a char filter  
> > that is defined in my settings?
> > 
> > Thanks,
> > 
> > Erdinç
> > 
> > --  
> > 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).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/9a78e66a-9302-4707-9acd-2c6cd73ab1af%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9a78e66a-9302-4707-9acd-2c6cd73ab1af%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCqPYoVmJ5YBM2EgPN3iF6f-%3DtgGYzZ0EcJLtco2xSTdw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCqPYoVmJ5YBM2EgPN3iF6f-%3DtgGYzZ0EcJLtco2xSTdw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Erdinc\_Yilmazel](https://avatars.discourse-cdn.com/v4/letter/e/e9bcb4/32.png) [@Erdinc\_Yilmazel](https://discuss.elastic.co/u/Erdinc_Yilmazel)\
**Post date:** [February 18, 2014, 3:31pm UTC](https://discuss.elastic.co/t/charfilter-support-in-analysis-api/15859/4 "2014-02-18T15:31:57Z")

</div>

Great! Thanks a lot Ivan.

On Monday, February 17, 2014 11:32:46 PM UTC-5, Ivan Brusic wrote:

> The change seemed simple, so I went ahead and implemented it:  
> [Add support for char filters in the analyze API by brusic · Pull Request #5148 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/pull/5148)
> 
> The tricky part is getting the Elasticsearch team to notice. 🙂
> 
> --  
> Ivan
> 
> On Mon, Feb 17, 2014 at 2:13 PM, Ivan Brusic \<[iv...@brusic.com](mailto:iv...@brusic.com)\<javascript:\>
> 
> > wrote:
> 
> > Since your code is running as the same JVM as Elasticsearch, you have a  
> > few more options. Depending on your use case, you can bypass the analysis  
> > API and use the analyzers directly. Look at the test code in the analysis  
> > package, in particular the AnalysisModuleTests class. The key is building  
> > the AnalysisService
> > 
> > [https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java](https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java)
> > 
> > As far as your initial request, I am not sure why AnalyzeRequest does not  
> > support char filters. The underlying TransportAnalyzeAction class could  
> > support them.
> > 
> > Cheers,
> > 
> > Ivan
> > 
> > On Mon, Feb 17, 2014 at 12:24 PM, Erdinc Yilmazel \<[erdincy...@gmail.com](mailto:erdincy...@gmail.com)\<javascript:\>
> > 
> > > wrote:
> > 
> > > Hi,
> > > 
> > > I am building a plugin for elasticsearch and I am using the java api to  
> > > to send an analysis request. The AnalysisRequestBuilder class doesn't  
> > > support specifying the char filters unlike the tokenizer or the token  
> > > filters. The same thing also is true for the rest API too. Is there any  
> > > plan to add this feature?
> > > 
> > > Since I am writing a plugin that actually is deployed on the same JVM  
> > > with elasticsearch, is there a workaround that I can use? For instance, can  
> > > I inject an instance of CharFilterFactory into my code for a char filter  
> > > that is defined in my settings?
> > > 
> > > Thanks,
> > > 
> > > Erdinç
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/9a78e66a-9302-4707-9acd-2c6cd73ab1af%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9a78e66a-9302-4707-9acd-2c6cd73ab1af%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/eb0f6b29-0511-49cd-958a-0ab9d5de0b83%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/eb0f6b29-0511-49cd-958a-0ab9d5de0b83%40googlegroups.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, 1:49am UTC](https://discuss.elastic.co/t/charfilter-support-in-analysis-api/15859/5 "2017-07-06T01:49:25Z")

</div>


