Spec-Zone.ru › Elasticsearch 8
›Elasticsearch Guide [8.17] ›Анализ текста ›Справочник встроенных анализаторов

Простой анализатор

Анализатор simple разбивает текст на токены по любым небуквенным символам, таким как цифры, пробелы, тире и апострофы, отбрасывает небуквенные символы и преобразует заглавные буквы в строчные.

Пример

resp = client.indices.analyze(
    analyzer="simple",
    text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
response = client.indices.analyze(
  body: {
    analyzer: 'simple',
    text: "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone."
  }
)
puts response
const response = await client.indices.analyze({
  analyzer: "simple",
  text: "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
});
console.log(response);
POST _analyze
{
  "analyzer": "simple",
  "text": "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone."
}

Анализатор simple анализирует предложение и генерирует следующие токены:

[ the, quick, brown, foxes, jumped, over, the, lazy, dog, s, bone ]

Определение

Анализатор simple определяется одним токенизатором:

Токенизатор
  • Токенизатор Lowercase

Настройка

Для настройки анализатора simple дублируйте его, чтобы создать основу для пользовательского анализатора. Этот пользовательский анализатор можно модифицировать по мере необходимости, обычно добавив фильтры токенов.

resp = client.indices.create(
    index="my-index-000001",
    settings={
        "analysis": {
            "analyzer": {
                "my_custom_simple_analyzer": {
                    "tokenizer": "lowercase",
                    "filter": []
                }
            }
        }
    },
)
print(resp)
response = client.indices.create(
  index: 'my-index-000001',
  body: {
    settings: {
      analysis: {
        analyzer: {
          my_custom_simple_analyzer: {
            tokenizer: 'lowercase',
            filter: []
          }
        }
      }
    }
  }
)
puts response
const response = await client.indices.create({
  index: "my-index-000001",
  settings: {
    analysis: {
      analyzer: {
        my_custom_simple_analyzer: {
          tokenizer: "lowercase",
          filter: [],
        },
      },
    },
  },
});
console.log(response);
PUT /my-index-000001
{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_custom_simple_analyzer": {
          "tokenizer": "lowercase",
          "filter": [                          
          ]
        }
      }
    }
  }
}

Добавьте здесь фильтры токенов.

© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/analysis-simple-analyzer.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API