60

bash スクリプトを使用してこのコマンドを実行しようとしましたが、次のエラーが発生しました。

#!/bin/bash 

curl -XPOST 'localhost:9200/my_index/_close' 

curl -XPUT 'localhost:9200/my_index/_settings' -d '{ 
 "analysis": { 
    "analyzer": { 
      "ar_analyzer": { 
        "tokenizer": "standard", 
        "filter" : ["standard", "lowercase", "synonym", "ar_stemmer"] 
      }, 
      "fr_analyzer": { 
        "tokenizer": "standard", 
        "filter" : ["standard", "lowercase", "synonym", "fr_stemmer"] 
      } 
    }, 
    "filter" : { 
      "ar_stemmer" : { 
          "type" : "stemmer", 
          "name" : "arabic" 
      }, 
      "fr_stemmer" : { 
          "type" : "stemmer", 
          "name" : "french" 
      }, 
      "synonym" : { 
          "type" : "synonym", 
          "synonyms_path" : "synonyms.txt" 
      } 
    } 
  } 
}' 

curl -XPOST 'localhost:9200/my_index/_open' 

エラー スタック トレース:

{"エラー":"IndexPrimaryShardNotAllocatedException[[my_index] プライマリがポスト API に割り当てられていません]","ステータス":409}{"エラー":"ElasticSearchIllegalArgumentException[非動的設定を更新できません[[index.analysis.filter.ar_stemmer.名前、index.analysis.analyzer.fr_analyzer.filter.3、index.analysis.filter.synonym.type、index.analysis.analyzer.ar_analyzer.filter.0、index.analysis.analyzer.fr_analyzer.filter.0、index. analysis.analyzer.ar_analyzer.filter.1、index.analysis.analyzer.fr_analyzer.filter.2、index.analysis.analyzer.fr_analyzer.filter.1、index.analysis.analyzer.ar_analyzer.filter.2、index.analysis.アナライザー.ar_analyzer.filter.3、index.analysis.filter.ar_stemmer.type、index.analysis.filter.fr_stemmer.name、index.analysis.analyzer.ar_analyzer.tokenizer、index.analysis.filter.fr_stemmer.type、index.analysis.analyzer.fr_analyzer.tokenizer、index.analysis.filter.synonym.synonyms_path]] オープン インデックスの場合[[my_index]]]","status":400}

4

3 に答える 3

152

こんにちは、私はこのように設定を使用しています。

インデックスを閉じる

curl -XPOST 'localhost:9200/lookupindex/_close'

設定を更新する

curl -XPUT 'localhost:9200/lookupindex/_settings' -d '{
    "index": {
        "analysis": {
            "analyzer": {
                "custom_standard_analyzer": {
                    "type": "custom",
                    "tokenizer": "whitespace",
                    "filter": [
                        "lowercase",
                        "asciifolding",
                        "customstopwords"
                    ]
                },
                "phonetic_analyzer": {
                    "type": "custom",
                    "tokenizer": "standard",
                    "filter": [
                        "lowercase",
                        "asciifolding",
                        "phoneticstopwords"
                    ]
                }
            },
            "filter": {
                "customstopwords": {
                    "type": "stop",
                    "stopwords": [
                        "+",
                        ".",
                        " ",
                        "ca",
                        "fl",
                        "bc",
                        "b.c",
                        "b.c.e",
                        "bce",
                        "act.c.",
                        "act",
                        "style",
                        "style of",
                        "attr.",
                        "attr",
                        "manner of",
                        "manner",
                        "circle of",
                        "circle",
                        "after",
                        "near",
                        "copy",
                        "copy after",
                        "imitator",
                        "school, copy",
                        "studio",
                        "studio of",
                        "Italian school",
                        "workshop of",
                        "workshop",
                        "16th",
                        "or",
                        "17th c.",
                        "late follower",
                        "follower of",
                        "follower",
                        "attributed",
                        "near",
                        "copy after painting",
                        "by or after",
                        "fake",
                        "and school",
                        "workshop-copy",
                        "counterproof",
                        "copy after drawing",
                        "copy of",
                        "school of",
                        "called",
                        "copy IBS",
                        "German School",
                        "placed with",
                        "attribution"
                    ]
                },
                "phoneticstopwords": {
                    "type": "stop",
                    "stopwords": [
                        "+",
                        ",",
                        "-",
                        ".",
                        "ca",
                        "fl",
                        "bc",
                        "b.c",
                        "b.c.e",
                        "bce",
                        "act.c.",
                        "act",
                        "style",
                        "style of",
                        "attr.",
                        "attr",
                        "manner of",
                        "manner",
                        "circle of",
                        "circle",
                        "after",
                        "near",
                        "copy",
                        "copy after",
                        "imitator",
                        "school, copy",
                        "studio",
                        "studio of",
                        "Italian school",
                        "workshop of",
                        "workshop",
                        "16th",
                        "or",
                        "17th c.",
                        "late follower",
                        "follower of",
                        "follower",
                        "attributed",
                        "near",
                        "copy after painting",
                        "by or after",
                        "fake",
                        "and school",
                        "workshop-copy",
                        "counterproof",
                        "copy after drawing",
                        "copy of",
                        "school of",
                        "called",
                        "copy IBS",
                        "German School",
                        "placed with",
                        "attribution"
                    ]
                }
            }
        }
    }
}
'  

完了したら、インデックスを再度開きます

curl -XPOST 'localhost:9200/lookupindex/_open'
于 2013-11-04T11:02:55.737 に答える
12

同様の例外がありました。あなたの例は完全ですか?インデックスを閉じる前に作成していますか?

私の場合は、「インデックスを作成し、閉じて、設定を追加し、他の設定を追加し、マッピングを追加し、インデックスを開く」でした。インデックスの作成後、約 1 秒待機すると、例外が修正されました。

于 2014-06-25T16:47:18.817 に答える