लोचदार खोज बनाने के लिए कस्टम विश्लेषक का उपयोग कर अजगर ग्राहक HTTP 400 मुद्दा

0

सवाल

मैं कोशिश कर रहा हूँ बनाने के लिए एक कस्टम विश्लेषक के साथ लोचदार खोज अजगर ग्राहक. मैं बात कर रहा हूँ करने के लिए इस लेख में लचीला खोज प्रलेखन. लोचदार डॉक्स लेख

जब मैं भेज एक डाल अनुरोध के साथ निम्नलिखित JSON सेटिंग्स भेजता है 200 सफलता.

PUT my-index-000001
{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_custom_analyzer": { 
          "char_filter": [
            "emoticons"
          ],
          "tokenizer": "punctuation",
          "filter": [
            "lowercase",
            "english_stop"
          ]
        }
      },
      "tokenizer": {
        "punctuation": { 
          "type": "pattern",
          "pattern": "[ .,!?]"
        }
      },
      "char_filter": {
        "emoticons": { 
          "type": "mapping",
          "mappings": [
            ":) => _happy_",
            ":( => _sad_"
          ]
        }
      },
      "filter": {
        "english_stop": { 
          "type": "stop",
          "stopwords": "_english_"
        }
      }
    }
  }
}

मुद्दा आता है जब मैं करने की कोशिश के साथ भी ऐसा ही अजगर ग्राहक. यहाँ है कैसे मैं इसे उपयोग कर रहा हूँ.

settings.py को परिभाषित करने के लिए सेटिंग्स

settings = {
  "settings": {
    "analysis": {
      "analyzer": {
        "my_custom_analyzer": { 
          "char_filter": [
            "emoticons"
          ],
          "tokenizer": "punctuation",
          "filter": [
            "lowercase",
            "english_stop"
          ]
        }
      },
      "tokenizer": {
        "punctuation": { 
          "type": "pattern",
          "pattern": "[ .,!?]"
        }
      },
      "char_filter": {
        "emoticons": { 
          "type": "mapping",
          "mappings": [
            ":) => _happy_",
            ":( => _sad_"
          ]
        }
      },
      "filter": {
        "english_stop": { 
          "type": "stop",
          "stopwords": "_english_"
        }
      }
    }
  }
}

create-index helper method

es_connection.create_index(index_name="test", mapping=mapping, settings=settings)

es-client call

def create_index(self, index_name: str, mapping: Dict, settings) -> None:
        """
        Create an ES index.
        :param index_name: Name of the index.
        :param mapping: Mapping of the index
        """
        logging.info(f"Creating index {index_name} with the following schema: {json.dumps(mapping, indent=2)}")
        self.es_client.indices.create(index=index_name, ignore=400, mappings=mapping, settings=settings)

मैं प्राप्त निम्न त्रुटि लॉग से

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.analyzer.my_custom_analyzer.char_filter] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"}],"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.analyzer.my_custom_analyzer.char_filter] please check that any required plugins are installed, or check the breaking changes documentation for removed settings","suppressed":[{"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.analyzer.my_custom_analyzer.filter] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"},{"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.analyzer.my_custom_analyzer.tokenizer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"},{"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.char_filter.emoticons.mappings] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"},{"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.char_filter.emoticons.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"},{"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.filter.english_stop.stopwords] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"},{"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.filter.english_stop.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"},{"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.tokenizer.punctuation.pattern] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"},{"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.tokenizer.punctuation.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"}]},"status":400}

किसी भी विचार क्या इस समस्या के कारण ??? संबंधित अनदेखी करने के लिए 400 ???? धन्यवाद अग्रिम में.

पुनश्च - मैं का उपयोग कर रहा हूँ docker.elastic.co/elasticsearch/elasticsearch:7.15.1 और अजगर elasticsearch ग्राहक 7.15.1

elasticsearch python
2021-11-23 08:51:56
1

सबसे अच्छा जवाब

2

आप बस को दूर करने की जरूरत settings अनुभाग शीर्ष पर है, क्योंकि यह स्वचालित रूप से जोड़ा ग्राहक द्वारा कोड:

settings = {
  "settings": {          <--- remove this line
    "analysis": {
      "analyzer": {
2021-11-23 09:13:06

अन्य भाषाओं में

यह पृष्ठ अन्य भाषाओं में है

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................

इस श्रेणी में लोकप्रिय

लोकप्रिय सवाल इस श्रेणी में