-
-
Save stof/fb8c0daa6dd7d6f2fae6 to your computer and use it in GitHub Desktop.
ElasticSearch error when using the html_strip char filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove old data | |
curl -XDELETE "http://localhost:9200/test" | |
# Create index with settings | |
curl -XPOST "http://localhost:9200/test" -d ' | |
{ | |
"settings": { | |
"index": { | |
"analysis": { | |
"analyzer": { | |
"title": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": [ | |
"standard", | |
"asciifolding", | |
"lowercase", | |
"stop_mixed" | |
] | |
}, | |
"partial_title": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": [ | |
"standard", | |
"asciifolding", | |
"lowercase", | |
"small_edgeNgram", | |
"stop_mixed" | |
] | |
}, | |
"html_content": { | |
"type": "custom", | |
"tokenizer": "letter", | |
"filter": [ | |
"standard", | |
"asciifolding", | |
"lowercase", | |
"stop_mixed" | |
], | |
"char_filter": "html_strip" | |
} | |
}, | |
"filter": { | |
"small_edgeNgram": { | |
"side": "front,", | |
"max_gram": 10, | |
"min_gram": 1, | |
"type": "edgeNGram" | |
}, | |
"stop_mixed": { | |
"type": "stop", | |
"stopwords": [ | |
"_french_", | |
"_english_" | |
], | |
"remove_trailing": false | |
} | |
} | |
} | |
} | |
} | |
} | |
' | |
# Define mapping | |
curl -XPOST "http://localhost:9200/test/quiz/_mapping" -d ' | |
{ | |
"quiz": { | |
"_all": { | |
"enabled": false | |
}, | |
"properties": { | |
"description": { | |
"type": "string", | |
"store": true, | |
"analyzer": "html_content" | |
}, | |
"space_id": { | |
"type": "integer", | |
"store": true | |
}, | |
"title": { | |
"type": "string", | |
"store": true, | |
"index_analyzer": "partial_title", | |
"search_analyzer": "title" | |
} | |
} | |
} | |
} | |
' | |
# Index documents | |
curl -XPUT "http://localhost:9200/_bulk" -d ' | |
{"index":{"_index":"test","_type":"quiz","_id":1}} | |
{"title":"test","description":"<p>hello, this is a test about removing questions and answers<\\/p>","space_id":18} | |
{"index":{"_index":"test","_type":"quiz","_id":2}} | |
{"title":"my test quiz","description":"","space_id":24} | |
' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2015-01-21 16:52:30,119][DEBUG][action.bulk ] [Arkady Rossovich] [test][3] failed to execute bulk item (index) index {[test][quiz][2], source[{"title":"my test quiz","description":"","space_id":24}]} | |
java.lang.NoClassDefFoundError: Could not initialize class org.apache.lucene.analysis.charfilter.HTMLStripCharFilter | |
at org.elasticsearch.indices.analysis.PreBuiltCharFilters$1.create(PreBuiltCharFilters.java:37) | |
at org.elasticsearch.indices.analysis.PreBuiltCharFilters$2.create(PreBuiltCharFilters.java:62) | |
at org.elasticsearch.index.analysis.CustomAnalyzer.initReader(CustomAnalyzer.java:95) | |
at org.apache.lucene.analysis.AnalyzerWrapper.initReader(AnalyzerWrapper.java:117) | |
at org.apache.lucene.analysis.AnalyzerWrapper.initReader(AnalyzerWrapper.java:117) | |
at org.apache.lucene.analysis.Analyzer.tokenStream(Analyzer.java:178) | |
at org.apache.lucene.document.Field.tokenStream(Field.java:554) | |
at org.apache.lucene.index.DefaultIndexingChain$PerField.invert(DefaultIndexingChain.java:597) | |
at org.apache.lucene.index.DefaultIndexingChain.processField(DefaultIndexingChain.java:342) | |
at org.apache.lucene.index.DefaultIndexingChain.processDocument(DefaultIndexingChain.java:301) | |
at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:241) | |
at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:451) | |
at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1539) | |
at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1254) | |
at org.elasticsearch.index.engine.internal.InternalEngine.innerIndex(InternalEngine.java:563) | |
at org.elasticsearch.index.engine.internal.InternalEngine.index(InternalEngine.java:492) | |
at org.elasticsearch.index.shard.service.InternalIndexShard.index(InternalIndexShard.java:409) | |
at org.elasticsearch.action.bulk.TransportShardBulkAction.shardIndexOperation(TransportShardBulkAction.java:446) | |
at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:157) | |
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:535) | |
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:434) | |
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) | |
at java.lang.Thread.run(Thread.java:745) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"acknowledged":true}{"acknowledged":true}{"acknowledged":true}{"took":4,"errors":true,"items":[{"index":{"_index":"test","_type":"quiz","_id":"1","status":500,"error":"NoClassDefFoundError[Could not initialize class org.apache.lucene.analysis.charfilter.HTMLStripCharFilter]"}},{"index":{"_index":"test","_type":"quiz","_id":"2","status":500,"error":"NoClassDefFoundError[Could not initialize class org.apache.lucene.analysis.charfilter.HTMLStripCharFilter]"}}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment