Blog

번역 - elasticsearch의 용어

drscg 2018. 10. 5. 18:05
 analysis

Analysis is the process of converting full text to terms. Depending on which analyzer is used, these phrases: FOO BARFoo-Barfoo,bar will probably all result in the terms foo and bar. These terms are what is actually stored in the index. A full text query (not a term query) for FoO:bAR will also be analyzed to the terms foo,bar and will thus match the terms stored in the index. It is this process of analysis (both at index time and at search time) that allows Elasticsearch to perform full text queries. Also see text and term.

analysis는 full text 를 terms 로 변경하는 process이다. 사용되는 analyzer에 따라, FOO BARFoo-Barfoo,bar 같은 문구는 아마도 모두 foo and bar 라는 terms가 될 것이다. 이들 terms가 실제로 index에 저장되는 것이다. FoO:bAR 에 대한 full text query(term query가 아닌) 또한 terms foo,bar 로 analyze될 것이고, 따라서 index에 저장된 terms에 일치할 것이다. elasticsearch에서 full text query가 가능한 것은 이 analysis process(index할 때와 search할 때 모두) 덕분이다. text and term 도 참고하자.

cluster

A cluster consists of one or more nodes which share the same cluster name. Each cluster has a single master node which is chosen automatically by the cluster and which can be replaced if the current master node fails.

cluster는 동일한 cluster name을 가진 하나 이상의 nodes 로 구성한다. 각 cluster는 cluster에 의해 자동으로 선택된 단일 master node를 가진다. master node는 현재 master node에 장애가 발생하면 교체될 수 있다.

document

A document is a JSON document which is stored in Elasticsearch. It is like a row in a table in a relational database. Each document is stored in an index and has a type and an id. A document is a JSON object (also known in other languages as a hash / hashmap / associative array) which contains zero or more fields, or key-value pairs. The original JSON document that is indexed will be stored in the _source field, which is returned by default when getting or searching for a document.

dociment는 Elasticsearch에 저장되는 JSON document이다. RDB에서 table의 row와 유사하다. 각 documenrt는 index 에 저장되고, type 과 id 를 가진다. document는 0개 이상의 fields 또는 key-value 쌍을 가진 JSON object(다른 language에서는 hash / hashmap / 관계형 array로 알려진)이다. JSON document 원본은 _source field 에 저장되는데, 이는 document를 가져오거나 검색할 경우 기본적으로 return된다.

id

The ID of a document identifies a document. The index/id of a document must be unique. If no ID is provided, then it will be auto-generated. (also see routing)

document 의 ID는 document를 구분한다. document의 index/id는 반드시 유일해야 한다. ID가 제공되지 않으면, 자동으로 생성된다. (routing 도 참고하자)

field

document contains a list of fields, or key-value pairs. The value can be a simple (scalar) value (eg a string, integer, date), or a nested structure like an array or an object. A field is similar to a column in a table in a relational database. The mapping for each field has a field type (not to be confused with document type) which indicates the type of data that can be stored in that field, eg integerstringobject. The mapping also allows you to define (amongst other things) how the value for a field should be analyzed.

document는 field의 목록이나 key-value 쌍을 가지고 있다. 값은 간단한(scalar) 값(문자열, 숫자, 날짜 등)이나 array나 object 같은 nested 구조가 될 수 있다. filed는 RDB에서 table의 column과 유사하다. 각 field의 mapping 은 field type (document type 과 혼동하지 말자)을 가지는데, 이는 해당 field에 저장될 수 있는 data의 형태(integerstringobject 등)을 가리킨다. 또한, mapping을 통해 field의 값을 analyze하는 방법을 정의할 수 있다.

filter

A filter is a non-scoring query, meaning that it does not score documents. It is only concerned about answering the question - "Does this document match?". The answer is always a simple, binary yes or no. This kind of query is said to be made in a filter context, hence it is called a filter. Filters are simple checks for set inclusion or exclusion. In most cases, the goal of filtering is to reduce the number of documents that have to be examined.

filter는 score를 계산하지 않는 query 이다. "이 document가 일치하는가" 라는 질문에 대한 답에만 영향을 미친다. 그 답은 항상 단순한 yes 또는 no 이다. 이런 종류의 query는 filter context 에서 생성되므로 filter라 한다. filter는 포함 또는 제외에 대한 간단한 확인이다. 대부분의 경우, filtering의 목적은 확인해야 하는 document의 수를 줄이는 것이다.

index

An index is like a table in a relational database. It has a mapping which contains a type, which contains the fields in the index. An index is a logical namespace which maps to one or more primary shards and can have zero or more replica shards.

index는 RDB의 table과 유사하다. type 을 포함하는 mapping 을 가지고 있고, index의 field 를 포함한다. index는 하나 이상의 primary shard 와 0개 이상의 replica shard 를 가진 논리적인 namespace이다.

mapping

A mapping is like a schema definition in a relational database. Each index has a mapping, which defines a type, plus a number of index-wide settings. A mapping can either be defined explicitly, or it will be generated automatically when a document is indexed.

mapping은 RDB의 schema 정의와 유사하다. 각 index 는 mapping을 가지는데, 그것은 type 을 정의하고, 더하여 index 전반에 걸친 설정을 다수 정의한다. mapping은 명시적으로 정의되거나, document가 index될 때, 자동으로 생성된다.

node

A node is a running instance of Elasticsearch which belongs to a cluster. Multiple nodes can be started on a single server for testing purposes, but usually you should have one node per server. At startup, a node will use unicast to discover an existing cluster with the same cluster name and will try to join that cluster.

node는 cluster 에 포함되는 Elasticsearch의 실행중인 instance이다. 테스트를 목적으로, 다수의 node를 단일 server에서 시작할 수 있지만, 일반적으로 server당 하나의 node가 있어야 한다. 시작할 때, node는 unicast를 사용하여 동일한 cluster 이름을 가진 기존의 cluster를 검색하고, 해당 cluster에 join하려 한다.

primary shard

Each document is stored in a single primary shard. When you index a document, it is indexed first on the primary shard, then on all replicas of the primary shard. By default, an index has 5 primary shards. You can specify fewer or more primary shards to scale the number of documents that your index can handle. You cannot change the number of primary shards in an index, once the index is created. See also routing.

각 document는 단일 primary shard 에 저장된다. document를 index하면, 먼저 primary shard에 색인되고, 그 다음에 primary shard의 모든 replicas 에 색인된다. 기본적으로 index 는 5개의 primary shard를 가진다. index가 처리할 수 있는 documents 의 수를 조절하기 위하여, primary shard의 수를 더 적게 혹은 더 많게 지정할 수 있다. 일단 index가 생성되면, index에 있는 primary shard의 수는 변경할 수 없다. routing 을 참고하자.

query

A query is the basic component of a search. A search can be defined by one or more queries which can be mixed and matched in endless combinations. While filters are queries that only determine if a document matches, those queries that also calculate how well the document matches are known as "scoring queries". Those queries assign it a score, which is later used to sort matched documents. Scoring queries take more resources than non scoring queries and their query results are not cacheable. As a general rule, use query clauses for full-text search or for any condition that requires scoring, and use filters for everything else.

query는 search의 기본 요소이다. search는 하나 이상의 query로 정의될 수 있는데, 이것은 무한한 조합으로 조합으로 섞이고 일치될 수 있다. filter 는 오직 document가 일치하는지를 결정하는 query인 반면에, document가 일치하는 정도를 계산하는 query를 "score를 계산하는 query"라고 한다.이들 query는 나중에 일치하는 document를 정렬하는데 사용되는 score를 document에 할당한다. score를 계산하는 querys는 score를 계산하지 않는 query(non scoring queries)보다 많은 resource를 사용하며, query 결과는 cache되지 않는다. 일반적으로, full-text search나 score 계산이 필요한 조건에 대해 query절을 사용하며, 다른 모든 것에 대해서는 filter를 사용한다.

replica shard

Each primary shard can have zero or more replicas. A replica is a copy of the primary shard, and has two purposes:

  1. increase failover: a replica shard can be promoted to a primary shard if the primary fails
  2. increase performance: get and search requests can be handled by primary or replica shards. By default, each primary shard has one replica, but the number of replicas can be changed dynamically on an existing index. A replica shard will never be started on the same node as its primary shard.

각 primary shard는 0개 이상의 replica를 가진다. replica는 primary shard의 복사본으로, 2가지 목적을 가진다.

  1. failover 증가: primary에 장애가 발생한 경우, replica shard는 primary shard가 될 수 있다
  2. performance 증가: get 과 search request는 primary 또는 replica shard로 처리할 수 있다. 기본적으로, 각  primary shard는 하나의 replica가 있지만, replica의 수는 기존 index에서 동적으로 변경할 수 있다. replica shard는 절대로 primary shard와 동일한 node애서 시작될 수 없다.
routing

When you index a document, it is stored on a single primary shard. That shard is chosen by hashing the routing value. By default, the routing value is derived from the ID of the document or, if the document has a specified parent document, from the ID of the parent document (to ensure that child and parent documents are stored on the same shard). This value can be overridden by specifying a routing value at index time, or a routing field in the mapping.

document를 index할 경우, document는 단일 primary shard 에 저장된다. 해당 shard는 routing 값을 해싱하여 선택된다. 기본적으로, routing 값은 document ID에서 파생되거나, document가 특정 parent document를 가지고 있다면, parent document의 ID에서(child/parent document가 동일한 shard에 저장되는 것을 보장하기 위하여) 파생된다. 이 값은 index시에 routing 값을 지정하거나 mapping 에서 routing field 를 지정하여, 재정의할 수 있다.

shard

A shard is a single Lucene instance. It is a low-level “worker” unit which is managed automatically by Elasticsearch. An index is a logical namespace which points to primary and replica shards. Other than defining the number of primary and replica shards that an index should have, you never need to refer to shards directly. Instead, your code should deal only with an index. Elasticsearch distributes shards amongst all nodes in the cluster, and can move shards automatically from one node to another in the case of node failure, or the addition of new nodes.

shard는 단일 Lucene instance이며, Elasticsearch에 의해 자동으로 관리되는 low-level "worker" unit이다. index는 primary/replica shard를 가리키는 논리적인 namespace이다. index가 가져야 하는 primary/replica shard의 수를 정의하는 것 외에는, 절대로 직접 shard를 참조할 필요가 없다. 대신, code는 오직 index만 다루어야 한다. Elasticsearch는 cluster 의 모든 node 에 shard를 배포하며, node의 장애 또는 새로운 node가 추가된 경우에, 특정 node에서 다른 node로 shard를 자동으로 옮길 수 있다.

source field

By default, the JSON document that you index will be stored in the _source field and will be returned by all get and search requests. This allows you access to the original object directly from search results, rather than requiring a second step to retrieve the object from an ID.

기본적으로 index한 JSON document는_source field에 저장되고, get과 search request에 의해 return된다. 이렇게 하면, ID에서 object를 가져오는 두번째 단계가 필요하지 않고, search 결과에서 바로 원래 object에 access할 수 있다.

term

A term is an exact value that is indexed in Elasticsearch. The terms fooFooFOO are NOT equivalent. Terms (i.e. exact values) can be searched for using term queries. See also text and analysis.

term은 Elasticsearch에 index되는 정확한 값(exact value)이다. fooFooFOO 라는 terms는 동일하지 않다. terms(예를 들면, exact value)는 term query로 search될 수 있다. text와 analysis를 참고하자.

text

Text (or full text) is ordinary unstructured text, such as this paragraph. By default, text will be analyzed into terms, which is what is actually stored in the index. Text fields need to be analyzed at index time in order to be searchable as full text, and keywords in full text queries must be analyzed at search time to produce (and search for) the same terms that were generated at index time. See also term and analysis.

text(full text)는 이 문장처럼 일상적인 구조화되지 않은 text이다. 기본적으로 text는 analyze 되어 terms 가 되고, 이것이 index에 실제로 저장되는 것이다. text fields 는 full text로 검색할 수 있도록, index시에 analyze되어야 하고, full text query의 keyword는 index시에 생성된 것과 동일한 terms를 생성하여 검색할 수 있도록 search시에 analyze되어야 한다. term 과 analysis 를 참고하자.

type

A type used to represent the type of document, e.g. an email, a user, or a tweet. Types are deprecated and are in the process of being removed. See Removal of mapping types.

type은 document의 type(email, tweet 등)을 나타내는데 사용된다. type은 deprecate되었고, 제거될 것이다. Removal of mapping types 을 참고하자.