Elastic Search

ES API 정리 (rare한 것 )

miin1635@ 2023. 9. 21. 15:23

계속해서 추가할 예정이다. 

Returns documents that contain an indexed value for a field.

An indexed value may not exist for a document’s field due to a variety of reasons:

  • The field in the source JSON is null or []
  • The field has "index" : false set in the mapping
  • The length of the field value exceeded an ignore_above setting in the mapping
  • The field value was malformed and ignore_malformed was defined in the mapping

:해당 조건 query에 맞는 필드가 인덱스에 존재하는지 안하는지

 

Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance.

An edit distance is the number of one-character changes needed to turn one term into another. These changes can include:

  • Changing a character (box → fox)
  • Removing a character (black → lack)
  • Inserting a character (sic → sick)
  • Transposing two adjacent characters (act → cat):   

 :파라미터 조건으로 문자열을 찾는다.

 

value (Required, string): Term you wish to find in the provided <field>.

fuzziness(Optional, string): Maximum edit distance allowed for matching.

max_expansions :(Optional, integer) Maximum number of variations created. Defaults to 50.

Avoid using a high value in the max_expansions parameter, especially if the prefix_length parameter value is 0. High values in the max_expansions parameter can cause poor performance due to the high number of variations examined.

prefix_length (Optional, integer): Number of beginning characters left unchanged when creating expansions. Defaults to 0.

transpositions(Optional, Boolean) :  Indicates whether edits include transpositions of two adjacent characters (ab → ba). Defaults to true.

rewrite(Optional, string): Method used to rewrite the query. For valid values and more information, see the rewrite parameter.

 

Returns documents that contain a minimum number of exact terms in a provided field.

The terms_set query is the same as the terms query, except you can define the number of matching terms required to return a document.

: 기존 term query에서 minimum_should_matches를 적용한 쿼리

Wildcard query : https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html

Returns documents that contain terms matching a wildcard pattern.

A wildcard operator is a placeholder that matches one or more characters. For example, the * wildcard operator matches zero or more characters. You can combine wildcard operators with other characters to create a wildcard pattern.

 

: Match문인데, wildcard를 사용

 

rewrite parameter

 

Warning : This parameter is for expert users only. Changing the value of this parameter can impact search performance and relevance.

 

사용할 수 있는 API들 

The rewrite parameter determines:

  • How Lucene calculates the relevance scores for each matching document
  • Whether Lucene changes the original query to a bool query or bit set
  • If changed to a bool query, which term query clauses are included

For most uses, we recommend using the constant_score, constant_score_boolean, or top_terms_boost_N rewrite methods. 

 

 

'Elastic Search' 카테고리의 다른 글

ES - Runtime field  (0) 2023.10.17
Bool query (must 와 should)  (0) 2023.10.06
나에게 주어진 과제들  (0) 2023.09.15
ES 설치 체크리스트  (0) 2023.09.15
Modue 5~8 실습 내용 보강 (발표 후)  (0) 2023.08.07