결국 무엇이든 해내는 사람

ElasticSearch - lowercase, uppercase 토큰 필터 [ 예제, 설명 ] 본문

두서없는 공부 노트/ElasticSearch

ElasticSearch - lowercase, uppercase 토큰 필터 [ 예제, 설명 ]

kkm8257 2021. 12. 14. 16:28
반응형
-- 영어나 유럽어 기반의 텍스트들은 대소문자가 있다
-- 검색할 때에는 대소문자에 상관없이 가능하도록 처리 해 주어야 한다
-- 그래서 lowercase 토큰 필터는 거의 모든 텍스트 검색 사례에서 사용되는 토큰 필터이다.

GET _analyze
{
  "filter": [ "lowercase" ],
  "text": [ "Harry Potter and the Philosopher's Stone" ]
}


-- 소문자로 변경
{
  "tokens" : [
    {
      "token" : "harry potter and the philosopher's stone",
      "start_offset" : 0,
      "end_offset" : 40,
      "type" : "word",
      "position" : 0
    }
  ]
}




GET _analyze
{
  "filter": [ "uppercase" ],
  "text": [ "Harry Potter and the Philosopher's Stone" ]
}

-- 대문자로 변경 
{
  "tokens" : [
    {
      "token" : "HARRY POTTER AND THE PHILOSOPHER'S STONE",
      "start_offset" : 0,
      "end_offset" : 40,
      "type" : "word",
      "position" : 0
    }
  ]
}






반응형
Comments