alias field란

개발새발·2023년 3월 18일
0

elasticsearch

목록 보기
47/54

Alias Field란?

인덱스 매핑을 할 때, alias 를 통해 대체 이름을 정의할 수 있다.

사용법

PUT trips
{
  "mappings": {
    "properties": {
      "distance": {
        "type": "long"
      },
      "route_length_miles": {
        "type": "alias",
        "path": "distance"
      },
      "transit_mode": {
        "type": "keyword"
      }
    }
  }
}

제한사항

  • 타겟팅할(path에 지정할) 필드가 생성될 때 존재해야한다.
  • 타겟팅할 필드는 구체적인 필드여야한다.
    • 예를 들어, object타입의 경우, 타겟팅을 하고자 하는 필드를 명확히 적어줘야한다. ( ex: objectType.field1)
  • 타겟팅할 필드 별칭은 하나만 가질 수 있다.
  • 인덱스 또는 업데이트 요청에서 별칭을 사용할 수 없다.
  • _source 필터링에 별칭을 넣을 수 없다.

참고 : https://www.elastic.co/guide/en/elasticsearch/reference/current/field-alias.html

profile
발새발개

0개의 댓글