본문 바로가기
WIKI 기술 지식 베이스

Uppercase token filter

원문 보기 위키 갱신

출처: 문서

본문

Uppercase 토큰 필터

uppercase 토큰 필터는 분석 과정에서 모든 토큰(단어)을 대문자로 변환하는 데 사용해요.

예제

다음 예제 요청은 uppercase_example이라는 새 인덱스를 생성하고 uppercase 필터가 설정된 애널라이저를 구성해요:

PUT /uppercase_example
{
  "settings": {
    "analysis": {
      "filter": {
        "uppercase_filter": {
          "type": "uppercase"
        }
      },
      "analyzer": {
        "uppercase_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "uppercase_filter"
          ]
        }
      }
    }
  }
}

{% include copy-curl.html %}

생성된 토큰

다음 요청을 사용해서 애널라이저가 생성한 토큰을 확인해 보세요:

GET /uppercase_example/_analyze
{
  "analyzer": "uppercase_analyzer",
  "text": "OpenSearch is powerful"
}

{% include copy-curl.html %}

응답에는 생성된 토큰이 담겨 있어요:

{
  "tokens": [
    {
      "token": "OPENSEARCH",
      "start_offset": 0,
      "end_offset": 10,
      "type": "<ALPHANUM>",
      "position": 0
    },
    {
      "token": "IS",
      "start_offset": 11,
      "end_offset": 13,
      "type": "<ALPHANUM>",
      "position": 1
    },
    {
      "token": "POWERFUL",
      "start_offset": 14,
      "end_offset": 22,
      "type": "<ALPHANUM>",
      "position": 2
    }
  ]
}

더 알아보기 (Learn more)