2.X/1. Getting Started 93

1-03-05. Checking Whether a Document Exists

If all you want to do is to check whether a document exists—you’re not interested in the content at all—then use the HEAD method instead of the GET method. HEAD requests don’t return a body, just HTTP headers:document의 내용에는 전혀 관심이 없고, document가 존재하는지 여부만을 알고 싶다면, GET 대신에 HEAD method를 사용한다. HEAD request는 body를 반환하지 않고, HTTP header만을 반환한다.curl -i -XHEAD http://localhost:9200/website/blog/123Elasti..

1-03-06. Updating a Whole Document

Documents in Elasticsearch are immutable; we cannot change them. Instead, if we need to update an existing document, we reindex or replace it, which we can do using the same index API that we have already discussed in Indexing a Document.Elasticsearch에서 document는 불변 이다. document를 변경할 수 없다. 대신, 기존의 document를 업데이트하려면, reindex 또는 replace해야 한다. Indexing a Document에서 이미 이야기했던 것과 동일한 index API를 사용할 수 ..

1-03-07. Creating a New Document

How can we be sure, when we index a document, that we are creating an entirely new document and not overwriting an existing one?document를 색인할 때, 기존 document를 덮어쓰는 것이 아니라, 완전히 새로운 것을 생성한다는 것을 어떻게 보장할 수 있을까?Remember that the combination of _index, _type, and _id uniquely identifies a document. So the easiest way to ensure that our document is new is by letting Elasticsearch autogenerate a new uniq..

1-03-08. Deleting a Document

The syntax for deleting a document follows the same pattern that we have seen already, but uses the DELETE method :document를 삭제하는 문법은 우리가 이미 보았던 것과 동일한 형태를 가진다. 하지만, DELETE method를 사용한다.DELETE /website/blog/123COPY AS CURLVIEW IN SENSE If the document is found, Elasticsearch will return an HTTP response code of 200 OK and a response body like the following. Note that the _version number has been..

1-03-09. Dealing with Conflicts

When updating a document with the index API, we read the original document, make our changes, and then reindex the whole document in one go. The most recent indexing request wins: whichever document was indexed last is the one stored in Elasticsearch. If somebody else had changed the document in the meantime, their changes would be lost.index API를 사용하여 document를 업데이트하는 경우, 원래의 document를 읽고, 변경을 ..

1-03-11. Partial Updates to Documents

In Updating a Whole Document, we said that the way to update a document is to retrieve it, change it, and then reindex the whole document. This is true. However, using the update API, we can make partial updates like incrementing a counter in a single request.Updating a Whole Document에서, document를 업데이트하는 방식은 document를 가져와서 수정하고, 전체 document를 다시 색인 한다고 언급했다. 이것은 사실이다. 그러나 update API를 사용하면, 단일 req..

1-03-12. Retrieving Multiple Documents

As fast as Elasticsearch is, it can be faster still. Combining multiple requests into one avoids the network overhead of processing each request individually. If you know that you need to retrieve multiple documents from Elasticsearch, it is faster to retrieve them all in a single request by using the multi-get, or mget, API, instead of document by document.Elasticsearch가 빠른 만큼, 여전히 더 빨라질 수 있다. ..

1-03-13. Cheaper in Bulk

In the same way that mget allows us to retrieve multiple documents at once, the bulk API allows us to make multiple create, index, update, or delete requests in a single step. This is particularly useful if you need to index a data stream such as log events, which can be queued up and indexed in batches of hundreds or thousands.mget 이 다수의 document를 한번에 가져오는 것과 마찬가지로, bulk API는 다수의 create, index,..

1-04. Distributed Document Store

In the preceding chapter, we looked at all the ways to put data into your index and then retrieve it. But we glossed over many technical details surrounding how the data is distributed and fetched from the cluster. This separation is done on purpose; you don’t really need to know how data is distributed to work with Elasticsearch. It just works.이전 장에서, index에 데이터를 색인하고, 가져오는 모든 방법을 살펴보았다. 그러나, 데..