2.X/1. Getting Started

1-03-01. What Is a Document?

drscg 2017. 10. 1. 11:42

Most entities or objects in most applications can be serialized into a JSON object, with keys and values. key is the name of a field or property, and a value can be a string, a number, a Boolean, another object, an array of values, or some other specialized type such as a string representing a date or an object representing a geolocation:

대부분의 응용프로그램에서 대부분의 요소나 오브젝트는 key/value를 가진 JSON 오브젝트로 나타낼 수 있다. key 는 field나 property의 이름이고 value 는 문자열, 숫자, boolean, 다른 오브젝트, 값들의 배열, 날짜를 나타내는 문자열이나 위치 정보를 나타내는 오브젝트 같은 특별한 형태가 될 수 있다.

{
    "name":         "John Smith",
    "age":          42,
    "confirmed":    true,
    "join_date":    "2014-06-01",
    "home": {
        "lat":      51.5,
        "lon":      0.1
    },
    "accounts": [
        {
            "type": "facebook",
            "id":   "johnsmith"
        },
        {
            "type": "twitter",
            "id":   "johnsmith"
        }
    ]
}

Often, we use the terms object and document interchangeably. However, there is a distinction. An object is just a JSON object—similar to what is known as a hash, hashmap, dictionary, or associative array. Objects may contain other objects. In Elasticsearch, the term document has a specific meaning. It refers to the top-level, or root object that is serialized into JSON and stored in Elasticsearch under a unique ID.

흔히, object 와 document 라는 단어를 동일한 의미로 사용한다. 그러나 차이가 있다. object는 단지 hash, hashmap, dictionary, associative 배열로 알려진 것과 유사한, JSON 오브젝트다. 오브젝트는 다른 오브젝트를 포함할 수 있다. Elasticsearch에서, document 라는 단어는 특별한 의미를 가지고 있다. 그것은 JSON으로 표현되고, Elasticsearch에 유일한 ID로 저장되는 최상위 단계나 root object를 말한다.

Warning

Field names can be any valid string, but may not include periods.

field 이름은 어떤 유효한 문자열도 가능하다. 그러나 period(.)는 사용할 수 없다.


'2.X > 1. Getting Started' 카테고리의 다른 글

1-02-6. Coping with Failure  (0) 2017.10.01
1-03. Data In, Data Out  (0) 2017.10.01
1-03-02. Document Metadata  (0) 2017.10.01
1-03-03. Indexing a Document  (0) 2017.10.01
1-03-04. Retrieving a Document  (0) 2017.10.01