久しぶりに、Java アプリケーション経由で、Elasticsearch にアクセスしたところ、Index が close されているという意味っぽいエラーで落ちました。
org.elasticsearch.indices.IndexClosedException: closed
対応した際の記録を残します。
過去 正常終了していた curl コマンドを実行する
以前正常終了していた curl コマンドを叩いて確認したところ、やはり、index_closed_exception
がレスポンスで返却されました。
% curl -XGET localhost:9200/festival/_search?pretty -d '{"query":{"match":{"name":"高槻"}}}}'
{
"error" : {
"root_cause" : [
{
"type" : "index_closed_exception",
"reason" : "closed",
"index_uuid" : "x_KUTOgwQ2utEoTKe-WcQw",
"index" : "festival"
}
],
"type" : "index_closed_exception",
"reason" : "closed",
"index_uuid" : "x_KUTOgwQ2utEoTKe-WcQw",
"index" : "festival"
},
"status" : 403
}
そもそも Elasticsearch の index って何だか忘れてしまった。
以下に、index とは何かが記載されています。
MYSQLにおけるdatabaseがindex
。
そういえばそうだった気がします。
Elasticsearchチュートリアル - 不可視点
いつ、有効期限を切ったのかわからなかったので、調べてみたのですが、defaultは、off で無期限のようです。
How to test working TTL documents in Elasticsearch — Makina Corpus
とりあえず、open する
closeした理由が不明なので、少し腑に落ちないですが、一旦 index を open します。
open は curl コマンド経由 で実行可能なので、実行します。
% curl -XPOST 'localhost:9200/festival/_open'
{
"error": {
"root_cause": [
{
"type": "exception",
"reason": "Failed to verify index [festival/x_KUTOgwQ2utEoTKe-WcQw]"
}
],
"type": "exception",
"reason": "Failed to verify index [festival/x_KUTOgwQ2utEoTKe-WcQw]",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Unknown tokenizer type [kuromoji_tokenizer] for [kuromoji]"
}
},
"status": 500
}
そういえば、先日、
brew upgrade
を勢いあまってかけてしまったのですが、それが原因な気がしてきました。 plugin の状況を確認します。
% curl -X GET 'http://localhost:9200/_nodes/plugins?pretty'
{
"_nodes" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"cluster_name" : "elasticsearch_kensakurai",
"nodes" : {
"JlcSImkkRKu0kttzskrjxQ" : {
"name" : "JlcSImk",
"transport_address" : "10.0.1.11:9300",
"host" : "10.0.1.11",
"ip" : "10.0.1.11",
"version" : "5.5.2",
"build_hash" : "b2f0c09",
"roles" : [
"master",
"data",
"ingest"
],
"plugins" : [ ],
"modules" : [
{
"name" : "aggs-matrix-stats",
"version" : "5.5.2",
"description" : "Adds aggregations whose input are a list of numeric fields and output includes a matrix.",
"classname" : "org.elasticsearch.search.aggregations.matrix.MatrixAggregationPlugin",
"has_native_controller" : false
},
{
"name" : "ingest-common",
"version" : "5.5.2",
"description" : "Module for ingest processors that do not require additional security permissions or have large dependencies and resources",
"classname" : "org.elasticsearch.ingest.common.IngestCommonPlugin",
"has_native_controller" : false
},
{
"name" : "lang-expression",
"version" : "5.5.2",
"description" : "Lucene expressions integration for Elasticsearch",
"classname" : "org.elasticsearch.script.expression.ExpressionPlugin",
"has_native_controller" : false
},
{
"name" : "lang-groovy",
"version" : "5.5.2",
"description" : "Groovy scripting integration for Elasticsearch",
"classname" : "org.elasticsearch.script.groovy.GroovyPlugin",
"has_native_controller" : false
},
{
"name" : "lang-mustache",
"version" : "5.5.2",
"description" : "Mustache scripting integration for Elasticsearch",
"classname" : "org.elasticsearch.script.mustache.MustachePlugin",
"has_native_controller" : false
},
{
"name" : "lang-painless",
"version" : "5.5.2",
"description" : "An easy, safe and fast scripting language for Elasticsearch",
"classname" : "org.elasticsearch.painless.PainlessPlugin",
"has_native_controller" : false
},
{
"name" : "parent-join",
"version" : "5.5.2",
"description" : "This module adds the support parent-child queries and aggregations",
"classname" : "org.elasticsearch.join.ParentJoinPlugin",
"has_native_controller" : false
},
{
"name" : "percolator",
"version" : "5.5.2",
"description" : "Percolator module adds capability to index queries and query these queries by specifying documents",
"classname" : "org.elasticsearch.percolator.PercolatorPlugin",
"has_native_controller" : false
},
{
"name" : "reindex",
"version" : "5.5.2",
"description" : "The Reindex module adds APIs to reindex from one index to another or update documents in place.",
"classname" : "org.elasticsearch.index.reindex.ReindexPlugin",
"has_native_controller" : false
},
{
"name" : "transport-netty3",
"version" : "5.5.2",
"description" : "Netty 3 based transport implementation",
"classname" : "org.elasticsearch.transport.Netty3Plugin",
"has_native_controller" : false
},
{
"name" : "transport-netty4",
"version" : "5.5.2",
"description" : "Netty 4 based transport implementation",
"classname" : "org.elasticsearch.transport.Netty4Plugin",
"has_native_controller" : false
}
]
}
}
}
kuromoji plugin のインストール
kuromoji plugin をインストールします。
sudo elasticsearch-plugin install analysis-kuromoji
-> Downloading analysis-kuromoji from elastic
[=================================================] 100%
-> Installed analysis-kuromoji
% curl -X GET 'http://localhost:9200/_nodes/plugins?pretty'
{
"_nodes" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"cluster_name" : "elasticsearch_kensakurai",
"nodes" : {
"JlcSImkkRKu0kttzskrjxQ" : {
"name" : "JlcSImk",
"transport_address" : "10.0.1.11:9300",
"host" : "10.0.1.11",
"ip" : "10.0.1.11",
"version" : "5.5.2",
"build_hash" : "b2f0c09",
"roles" : [
"master",
"data",
"ingest"
],
"plugins" : [
{
"name" : "analysis-kuromoji",
"version" : "5.5.2",
"description" : "The Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis module into elasticsearch.",
"classname" : "org.elasticsearch.plugin.analysis.kuromoji.AnalysisKuromojiPlugin",
"has_native_controller" : false
}
],
"modules" : [
{
"name" : "aggs-matrix-stats",
"version" : "5.5.2",
"description" : "Adds aggregations whose input are a list of numeric fields and output includes a matrix.",
"classname" : "org.elasticsearch.search.aggregations.matrix.MatrixAggregationPlugin",
"has_native_controller" : false
},
{
"name" : "ingest-common",
"version" : "5.5.2",
"description" : "Module for ingest processors that do not require additional security permissions or have large dependencies and resources",
"classname" : "org.elasticsearch.ingest.common.IngestCommonPlugin",
"has_native_controller" : false
},
{
"name" : "lang-expression",
"version" : "5.5.2",
"description" : "Lucene expressions integration for Elasticsearch",
"classname" : "org.elasticsearch.script.expression.ExpressionPlugin",
"has_native_controller" : false
},
{
"name" : "lang-groovy",
"version" : "5.5.2",
"description" : "Groovy scripting integration for Elasticsearch",
"classname" : "org.elasticsearch.script.groovy.GroovyPlugin",
"has_native_controller" : false
},
{
"name" : "lang-mustache",
"version" : "5.5.2",
"description" : "Mustache scripting integration for Elasticsearch",
"classname" : "org.elasticsearch.script.mustache.MustachePlugin",
"has_native_controller" : false
},
{
"name" : "lang-painless",
"version" : "5.5.2",
"description" : "An easy, safe and fast scripting language for Elasticsearch",
"classname" : "org.elasticsearch.painless.PainlessPlugin",
"has_native_controller" : false
},
{
"name" : "parent-join",
"version" : "5.5.2",
"description" : "This module adds the support parent-child queries and aggregations",
"classname" : "org.elasticsearch.join.ParentJoinPlugin",
"has_native_controller" : false
},
{
"name" : "percolator",
"version" : "5.5.2",
"description" : "Percolator module adds capability to index queries and query these queries by specifying documents",
"classname" : "org.elasticsearch.percolator.PercolatorPlugin",
"has_native_controller" : false
},
{
"name" : "reindex",
"version" : "5.5.2",
"description" : "The Reindex module adds APIs to reindex from one index to another or update documents in place.",
"classname" : "org.elasticsearch.index.reindex.ReindexPlugin",
"has_native_controller" : false
},
{
"name" : "transport-netty3",
"version" : "5.5.2",
"description" : "Netty 3 based transport implementation",
"classname" : "org.elasticsearch.transport.Netty3Plugin",
"has_native_controller" : false
},
{
"name" : "transport-netty4",
"version" : "5.5.2",
"description" : "Netty 4 based transport implementation",
"classname" : "org.elasticsearch.transport.Netty4Plugin",
"has_native_controller" : false
}
]
}
}
}
再度 index を open する
% curl -XPOST 'localhost:9200/festival/_open'
{"acknowledged":true}%
brew upgrade
を実行すると、結構何がおこるかわかりません。
以上です。
コメント