norms 매핑 파라미터

norms 매핑 파라미터

norms 매핑 파라미터는 필드에 대한 정규화 요소(normalization factor)를 계산하고 저장할지 여부를 제어해요. 이 요소들은 쿼리 스코어링 중에 사용되어 검색 결과의 관련성을 조정해요. 다만 norms를 저장하면 인덱스 크기가 커지고 추가 메모리를 소비하게 돼요.

기본적으로 norms는 관련성 스코어링이 중요한 text 필드에서 활성화돼요. 필터링에만 사용하는 keyword 필드처럼 스코어링 기능이 필요 없는 필드는 norms를 비활성화한 상태로 구성해요.

출처: 문서

본문

필드에서 norms 비활성화하기

다음 요청은 description 필드가 norms가 비활성화된 text 필드인 products 인덱스를 생성해요:

PUT /products
{
  "mappings": {
    "properties": {
      "description": {
        "type": "text",
        "norms": false
      }
    }
  }
}

기존 인덱스의 필드에서 norms를 비활성화하려면 다음 요청을 사용해요:

PUT /products/_mapping
{
  "properties": {
    "review": {
      "type": "text",
      "norms": false
    }
  }
}

norms가 비활성화된 필드에서 norms를 활성화하는 것은 불가능하며, 활성화를 시도하면 다음 오류가 발생해요:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Mapper for [description] conflicts with existing mapper:\n\tCannot update parameter [norms] from [false] to [true]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Mapper for [description] conflicts with existing mapper:\n\tCannot update parameter [norms] from [false] to [true]"
  },
  "status": 400
}

더 알아보기 (Learn more)