엘라스틱 키워드 필드의 ignore_above
로그스태시를 이용한 데이터 연동 시 문자열 데이터는 형태소 단위로 인덱싱하는 text 타입과 집계 정렬 목적으로 인덱싱을 하지 않는 keyword 타입, 2개의 필드에 저장된다.이때 keyword 타입 필드는 ignore_above 값(기본값은 256)보다 길이가 긴 데이터를 저장하지 않는다고 한다. 실제 text와 keyword 필드를 비교해보니 저장 결과가 다른 상황 발생.

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"
}
}
}
}
}재인덱싱 후 다시 비교해봤다. 필드 유실 없음.

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


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