Unknown char_filter type [pattern_replace]

Hi,
I'm trying to upgrade java api's to support elastic 6.2.2 . I'm getting below exception for unit tests :

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.Client]: Factory method 'create' threw exception; nested exception is **java.lang.IllegalArgumentException: Unknown char_filter type [pattern_replace] for [my_char_filter]**
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
	... 43 more
Caused by: java.lang.IllegalArgumentException: Unknown char_filter type [pattern_replace] for [my_char_filter]
	at org.elasticsearch.index.analysis.AnalysisRegistry.getAnalysisProvider(AnalysisRegistry.java:391)

Are you trying to embed elasticsearch ?

Existing application already uses ES , we are migrating to 6.2.2 from 2.3.2 and so need to update the java apis'.

Template Cluster Initializer fails for below template settings :

"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"char_filter": [
"my_char_filter"
]
}
},
"char_filter": {
"my_char_filter": {
"type": "pattern_replace",
"pattern": "(\d+)-(?=\d)",
"replacement": "$1_"
}
}
}
}

Using below dependency in pom:

<dependency>
  <groupId>org.elasticsearch</groupId>
  <artifactId>elasticsearch</artifactId>
  <version>6.2.2</version>
</dependency>

My question was more: are you trying to start an elasticsearch node from your java test code?

Yes.

It's not possible to do so. Read https://www.elastic.co/blog/elasticsearch-the-server

Note that to run integration tests (not unit tests) you need a real elasticsearch server. Read In memory testing with RestHighLevelClient

1 Like

Thankyou that was helpful .

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.