Non è possibile creare personalizzato analizzatore elaticsearch

0

Domanda

Sto cercando di creare un custom analizzatore in elasticsearch. qui è l'analizzatore

{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_analyzer": {
          "tokenizer" : "standard",
          "filter" : ["custom_stopper", "custom_stems", "custom_synonyms"]
        },
        "filter" : {
            "custom_stopper" : {
                "type" : "stop",
                "stopwords_path" : "analyze/stopwords.txt"
            },
            "custom_stems" : {
                "type" : "stemmer_override",
                "rules_path" : "analyze/stem.txt"
            },
            "custom_synonyms" : {
                "type" : "synonyms",
                "synonyms_path" : "analyze/synonym.txt"

            }
        }
        }
      }
    }
  }

ma gettando errore

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "analyzer [filter] must specify either an analyzer type, or a tokenizer"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "analyzer [filter] must specify either an analyzer type, or a tokenizer"
    },
    "status": 400
}

Che cosa sto facendo di sbagliato qui?

elasticsearch kibana
2021-11-23 13:06:23
1

Migliore risposta

1

Il filter deve essere allo stesso livello analyzer.

La struttura appare un po ' come questo:

{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_analyzer": {
          "tokenizer": "standard",
          "char_filter": [
            "custom_stopper",
            "custom_stems",
            "custom_synonyms"
          ]
        }
      },
      "filter": {
        "custom_stopper": {
          "type": "stop",
          "stopwords_path": "analyze/stopwords.txt"
        },
        "custom_stems": {
          "type": "stemmer_override",
          "rules_path": "analyze/stem.txt"
        },
        "custom_synonyms": {
          "type": "synonyms",
          "synonyms_path": "analyze/synonym.txt"
        }
      }
    }
  }
}
2021-11-23 13:20:28

In altre lingue

Questa pagina è in altre lingue

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