# Problem configuring PatternReplaceFilter

**URL:** <https://discuss.elastic.co/t/problem-configuring-patternreplacefilter/5017>\
**Category:** Elasticsearch\
**Created:** [August 1, 2011, 4:08pm UTC](https://discuss.elastic.co/t/problem-configuring-patternreplacefilter/5017 "2011-08-01T16:08:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Reelsen](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@Alexander\_Reelsen](https://discuss.elastic.co/u/Alexander_Reelsen)\
**Post date:** [August 1, 2011, 4:08pm UTC](https://discuss.elastic.co/t/problem-configuring-patternreplacefilter/5017/1 "2011-08-01T16:08:25Z")

</div>

Hi there,

I am having trouble configuring the pattern replace filter

My configuration looks like this:

index:  
analysis:  
analyzer:  
default:  
type: ae\_analyzer

```
  ae_analyzer:
    type: custom
    tokenizer: standard
    filter: [umlaut_replace]

filter:
  umlaut_replace:
    type : pattern_replace
    pattern: "ä"
    replacement: "a"

```

The exception I get on startup is:

INFO: An exception was caught and reported. Message:  
org.elasticsearch.ElasticSearchIllegalArgumentException: Token Filter  
[umlaut\_replace] must have a type associated with it  
org.elasticsearch.ElasticSearchIllegalArgumentException: Token Filter  
[umlaut\_replace] must have a type associated with it

Taking a look at the analysis module, there is a line referencing  
org.elasticsearch  
type = tokenFilterSettings.getAsClass("type", null,  
"org.elasticsearch.index.analysis.", "TokenFilterFactory");

However the PatternStringFilter is at some org.apache package...

Might this be the cause or am I simply misconfiguring something badly?

Regards, Alexander

---

<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:** [August 1, 2011, 9:03pm UTC](https://discuss.elastic.co/t/problem-configuring-patternreplacefilter/5017/2 "2011-08-01T21:03:41Z")

</div>

Can you do a get settings to see if the type is really there for the filter  
(note, settings get munged into key value pairs)? Also, for this usecase,  
though I would love to help fixing it, you might want to consider using the  
asciifolding filter? (

> **[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.

).

On Mon, Aug 1, 2011 at 7:08 PM, Alexander Reelsen \<  
[alexander.reelsen@googlemail.com](mailto:alexander.reelsen@googlemail.com)\> wrote:

> Hi there,
> 
> I am having trouble configuring the pattern replace filter
> 
> My configuration looks like this:
> 
> index:  
> analysis:  
> analyzer:  
> default:  
> type: ae\_analyzer
> 
> ```
> ae_analyzer:
> type: custom
> tokenizer: standard
> filter: [umlaut_replace]
> 
> ```
> 
> filter:  
> umlaut\_replace:  
> type : pattern\_replace  
> pattern: "ä"  
> replacement: "a"
> 
> The exception I get on startup is:
> 
> INFO: An exception was caught and reported. Message:  
> org.elasticsearch.ElasticSearchIllegalArgumentException: Token Filter  
> [umlaut\_replace] must have a type associated with it  
> org.elasticsearch.ElasticSearchIllegalArgumentException: Token Filter  
> [umlaut\_replace] must have a type associated with it
> 
> Taking a look at the analysis module, there is a line referencing  
> org.elasticsearch  
> type = tokenFilterSettings.getAsClass("type", null,  
> "org.elasticsearch.index.analysis.", "TokenFilterFactory");
> 
> However the PatternStringFilter is at some org.apache package...
> 
> Might this be the cause or am I simply misconfiguring something badly?
> 
> Regards, Alexander

---

<div class="post-metadata">

**Author:** ![Alexander\_Reelsen](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@Alexander\_Reelsen](https://discuss.elastic.co/u/Alexander_Reelsen)\
**Post date:** [August 2, 2011, 11:28am UTC](https://discuss.elastic.co/t/problem-configuring-patternreplacefilter/5017/3 "2011-08-02T11:28:37Z")

</div>

Hi,

Completely my fault. I tested against a 0.16 version of elasticsearch,  
where the filter was not included yet. Works smoothly with 0.17. Sorry  
for that.

I did not upgrade to 0.17, because the installation of plugins on the  
filesystem did not work like in 0.16. I tracked it down because of not  
using the complete file:/// URL, which is needed now in 0.17 instead  
of only providing a directory as in 0.16. This resulted in some  
zipfileexception (which is in fact a file not found error). Now our  
river implementation also works with 0.17 and we upgraded.

Thanks for helping, going to hide ashamed behind a rock now 🙂

--Alexander

---

<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:** [August 2, 2011, 12:54pm UTC](https://discuss.elastic.co/t/problem-configuring-patternreplacefilter/5017/4 "2011-08-02T12:54:23Z")

</div>

Aha! That explains the situation I was experiencing the other day after  
upgrading. I assumed it was due to the zip file being wrongly named.

--  
Ivan

On Tue, Aug 2, 2011 at 7:28 AM, Alexander Reelsen \<  
[alexander.reelsen@googlemail.com](mailto:alexander.reelsen@googlemail.com)\> wrote:

> I did not upgrade to 0.17, because the installation of plugins on the  
> filesystem did not work like in 0.16. I tracked it down because of not  
> using the complete file:/// URL, which is needed now in 0.17 instead  
> of only providing a directory as in 0.16. This resulted in some  
> zipfileexception (which is in fact a file not found error). Now our  
> river implementation also works with 0.17 and we upgraded.

---

<div class="post-metadata">

**Author:** ![Jan\_Fiedler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jan_fiedler/32/2518_2.png) [@Jan\_Fiedler](https://discuss.elastic.co/u/Jan_Fiedler)\
**Post date:** [August 3, 2011, 7:05am UTC](https://discuss.elastic.co/t/problem-configuring-patternreplacefilter/5017/5 "2011-08-03T07:05:58Z")

</div>

Maybe off topic but maybe helpful anyway: Instead of using the  
PatternReplaceFilter you may want to look at the ASCIIFoldingFilter that  
automatically converts lots of non ASCII characters (such as German umlauts)  
into their ASCII equivalents (  
[http://lucene.apache.org/java/3\_0\_0/api/core/org/apache/lucene/analysis/ASCIIFoldingFilter.html](http://lucene.apache.org/java/3_0_0/api/core/org/apache/lucene/analysis/ASCIIFoldingFilter.html)).  
This way you would not have to define explicit mappings for every character  
and would automatically cover other common cases such as accented chars  
(like in Créme).

---

<div class="post-metadata">

**Author:** ![Alexander\_Reelsen](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@Alexander\_Reelsen](https://discuss.elastic.co/u/Alexander_Reelsen)\
**Post date:** [August 3, 2011, 7:14am UTC](https://discuss.elastic.co/t/problem-configuring-patternreplacefilter/5017/6 "2011-08-03T07:14:04Z")

</div>

Hi Jan,

On 3 Aug., 09:05, Jan Fiedler [fiedler....@gmail.com](mailto:fiedler....@gmail.com) wrote:

> Maybe off topic but maybe helpful anyway: Instead of using the  
> PatternReplaceFilter you may want to look at the ASCIIFoldingFilter that  
> automatically converts lots of non ASCII characters (such as German umlauts)  
> into their ASCII equivalents ([http://lucene.apache.org/java/3\_0\_0/api/core/org/apache/lucene/analys](http://lucene.apache.org/java/3_0_0/api/core/org/apache/lucene/analys)...).  
> Right. As far as I know this works only, if you want to create a from  
> ä... in some special cases you might want to create "ae" instead

--Alexander

---

<div class="post-metadata">

**Author:** ![Jan\_Fiedler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jan_fiedler/32/2518_2.png) [@Jan\_Fiedler](https://discuss.elastic.co/u/Jan_Fiedler)\
**Post date:** [August 3, 2011, 7:27am UTC](https://discuss.elastic.co/t/problem-configuring-patternreplacefilter/5017/7 "2011-08-03T07:27:33Z")

</div>

Yeah, if you are looking for the 'ä' -\> 'ae' you may find the following  
thread helpful (  
[http://elasticsearch-users.115913.n3.nabble.com/Folding-German-characters-like-umlauts-td2176078.html](http://elasticsearch-users.115913.n3.nabble.com/Folding-German-characters-like-umlauts-td2176078.html)).  
I have not tried the German2 stemmer myself. Based on pure Lucene (2.x back  
then) I relied on the synonym approach described in the thread.

---

<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:58am UTC](https://discuss.elastic.co/t/problem-configuring-patternreplacefilter/5017/8 "2017-07-06T03:58:24Z")

</div>


