[Elasticsearch - The Definitive Guide] Mapping

Elastic/TheDefinitiveGuide 2015. 11. 30. 15:26

간혹 dynamic mapping 기능으로 인한 type mismatch 오류를 경험 하시는 분들이 있습니다.

그래서 기록해 봤습니다.

The Definitive Guide 에 올라온 Note 입니다.


원문링크)


원문 Snippet)

This means that if you index a number in quotes ("123"), it will be mapped as type string, not type long. However, if the field is already mapped as type long, then Elasticsearch will try to convert the string into a long, and throw an exception if it can’t.


정리 및 작은 팁을 말씀 드리면,

- 정수형 이면 그냥 long 으로 선언 하세요.

- 실수 형이면 그냥 double 로 선언 하세요.

- ".." 로 묶으면 string 형으로 선언 됩니다.

- dynamic mapping 은 explicity 하게 사용하시는게 좋은 습관 입니다.


: