> ## Content Index
> Fetch the complete content index at: https://www.popit.kr/llms.txt
> Use this file to discover other available public pages before exploring further.

# 엘라스틱 키워드 필드의 ignore_above
- URL: https://www.popit.kr/elasticsearch-keyword-field-ignore-above/
- Published: 2023-10-12T14:02:57.000Z
- Updated: 2023-10-12T14:16:29.000Z
- Author: 강 명훈
- Tags: #소프트웨어, elasticsearch, ignore_above

로그스태시를 이용한 데이터 연동 시 문자열 데이터는 형태소 단위로 인덱싱하는 text 타입과 집계 정렬 목적으로 인덱싱을 하지 않는 keyword 타입, 2개의 필드에 저장된다.이때 keyword 타입 필드는 [ignore\_above](https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html?ref=popit.kr) 값(기본값은 256)보다 길이가 긴 데이터를 저장하지 않는다고 한다. 실제 text와 keyword 필드를 비교해보니 저장 결과가 다른 상황 발생.

![text_vs_keyword](https://www.popit.kr/content/images/wp/2023/10/text_vs_keyword-600x355.png)

­

ignore\_above 수정.

```
PUT iislog-test
{
  "mappings": {
    "properties": {
      "agent": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 2560
          }
        }
      }
    }
  }
}
```

```
{
  “iislog-test": {
    "aliases": {},
    "mappings": {
      "properties": {
        "agent": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 2560
            }
          }
        }
      }
    },
    "settings": {
      "index": {
        "routing": {
          "allocation": {
            "include": {
              "_tier_preference": "data_content"
            }
          }
        },
        "number_of_shards": "1",
        "provided_name": "testttttt",
        "creation_date": "1689851100816",
        "number_of_replicas": "1",
        "uuid": "zSoylCrrRJ2OoAo4cNiwdQ",
        "version": {
          "created": "8040199"
        }
      }
    }
  }
}
```

재인덱싱 후 다시 비교해봤다. 필드 유실 없음.

![text_vs_keyword2](https://www.popit.kr/content/images/wp/2023/10/text_vs_keyword2-1-600x324.png)

­

agent 길이를 재보니 ignore\_above 수정 전 유실된 데이터 개수와 256보다 길이가 긴 데이터 개수가 같다.

![agent_len](https://www.popit.kr/content/images/wp/2023/10/agent_len-600x324.png)

![agent_len2](https://www.popit.kr/content/images/wp/2023/10/agent_len2-600x294.png)

 ­이거 다 keyword 필드에 저장 안 되고 있었는데 여태 몰랐네(..)