Invalid stemmer class specified: Cjk

Describe the Bug:
I configured Chinese store view in website using magento 2.1.7 EE and for catalog search im using Elastic search v 2.4.5. When triggering reindex documents are not getting generated in elastic search and receiving below error message.
java.lang.IllegalArgumentException: Invalid stemmer class specified: Cjk

Elasticsearch version:
Version: 2.4.5, Build: c849dd1/2017-04-24T16:18:17Z, JVM: 1.8.0_102

Plugins installed: []
analysis-smartcn
analysis-icu
head

JVM version (java -version):
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

OS version (uname -a if on a Unix-like system):
Linux gl-mel-tst 2.6.32-573.22.1.el6.x86_64 #1 SMP Thu Mar 17 03:23:39 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:
Expected result : Elastic search document needs to be created for Chinese store view

Provide logs (if relevant):

java.lang.IllegalArgumentException: Invalid stemmer class specified: Cjk
at org.apache.lucene.analysis.snowball.SnowballFilter.(SnowballFilter.java:83)
at org.elasticsearch.index.analysis.StemmerTokenFilterFactory.create(StemmerTokenFilterFactory.java:242)
at org.elasticsearch.index.analysis.CustomAnalyzer.createComponents(CustomAnalyzer.java:86)
at org.apache.lucene.analysis.AnalyzerWrapper.createComponents(AnalyzerWrapper.java:101)
at org.apache.lucene.analysis.AnalyzerWrapper.createComponents(AnalyzerWrapper.java:101)
at org.apache.lucene.analysis.Analyzer.tokenStream(Analyzer.java:176)
at org.apache.lucene.document.Field.tokenStream(Field.java:562)
at org.apache.lucene.index.DefaultIndexingChain$PerField.invert(DefaultIndexingChain.java:628)
at org.apache.lucene.index.DefaultIndexingChain.processField(DefaultIndexingChain.java:365)
at org.apache.lucene.index.DefaultIndexingChain.processDocument(DefaultIndexingChain.java:321)
at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:234)
at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:450)
at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1477)
at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1256)
at org.elasticsearch.index.engine.InternalEngine.innerIndex(InternalEngine.java:527)
at org.elasticsearch.index.engine.InternalEngine.index(InternalEngine.java:454)
at org.elasticsearch.index.shard.IndexShard.index(IndexShard.java:605)
at org.elasticsearch.index.engine.Engine$Index.execute(Engine.java:836)
at org.elasticsearch.action.index.TransportIndexAction.executeIndexRequestOnPrimary(TransportIndexAction.java:236)
at org.elasticsearch.action.bulk.TransportShardBulkAction.shardIndexOperation(TransportShardBulkAction.java:327)
at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:120)
at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:68)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryPhase.doRun(TransportReplicationAction.java:657)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:287)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:279)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)
at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:378)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.tartarus.snowball.ext.CjkStemmer
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.lucene.analysis.snowball.SnowballFilter.(SnowballFilter.java:79)
... 31 more```

I Just followed below steps to configure elastic search with magento and it works without any issues for english and japanese store views. http://devdocs.magento.com/guides/v2.1/config-guide/elasticsearch/configure-magento.html

Please format your code using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

Please edit your post.

Also could you tell what are your index settings?

Done

Thanks

Hi David,

I added below comment by editing the post. But its not appearing.

I Just followed below steps to configure elastic search with magento and it works without any issues for english and japanese store views. http://devdocs.magento.com/guides/v2.1/config-guide/elasticsearch/configure-magento.html

Regards
Palani

But add the index settings as a reply.

Hi David,

Please find the index setting.

{
  "Magento2_product_3_v2":{
    "settings":{
      "index":{
        "creation_date":"1516778661312",
        "analysis":{
          "filter":{
            "default_stemmer":{
              "type":"stemmer",
              "language":"cjk"
            },
            "Unique_stem":{
              "type":"unique",
              "only_on_same_position":"true"
            }
          },
          "Char_filter":{
            "default_char_filter":{
              "type":"html_strip"
            }
          },
          "Analyzer":{
            "default":{
              "filter":[
                "lowercase",
                "Keyword_repeat",
                "Default_stemmer",
                "Unique_stem"
              ],
              "Char_filter":[
                "default_char_filter"
              ],
              "Type":"custom",
              "tokenizer":"default_tokenizer"
            }
          },
          "Tokenizer":{
            "default_tokenizer":{
              "type":"standard"
            }
          }
        },
        "Number_of_shards":"5",
        "number_of_replicas":"1",
        "uuid":"1CCZwag2ThCpTdJeJ4U1IQ",
        "version":{
          "created":"2040599"
        }
      }
    }
  }
}

This worked well (tested on 6.2.0):

DELETE test
PUT test
{
  "settings": {
    "index": {
      "analysis": {
        "filter": {
          "default_stemmer": {
            "type": "stemmer",
            "language": "cjk"
          },
          "unique_stem": {
            "type": "unique",
            "only_on_same_position": "true"
          }
        },
        "char_filter": {
          "default_char_filter": {
            "type": "html_strip"
          }
        },
        "analyzer": {
          "default": {
            "filter": [
              "lowercase",
              "keyword_repeat",
              "default_stemmer",
              "unique_stem"
            ],
            "char_filter": [
              "default_char_filter"
            ],
            "type": "custom",
            "tokenizer": "default_tokenizer"
          }
        },
        "tokenizer": {
          "default_tokenizer": {
            "type": "standard"
          }
        }
      },
      "number_of_shards": 5,
      "number_of_replicas": 1
    }
  }
}

I changed few things that were not correct.
I'm not sure what's wrong in your case then.

Could you reproduce the problem as I did and share the exact script which is failing?
And may be ask the magento forums?

1 Like

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