PaginatedJsonQueryElasticsearch

PaginatedJsonQueryElasticsearch

Elasticsearch JSON DSL로 작성된 (집계를 포함한) 페이지네이션 쿼리를 실행하는 프로세서예요. 많은 문서를 페이지 단위로 나눠 가져올 수 있어요.

출처: Snowflake 문서 — PaginatedJsonQueryElasticsearch

본문

번들 (Bundle)

org.apache.nifi | nifi-elasticsearch-restapi-nar

설명

Elasticsearch JSON DSL로 작성된 (집계가 포함된) 페이지네이션 쿼리를 실행할 수 있게 해주는 프로세서예요. QUERY 속성이 채워져 있지 않으면 flowfile의 콘텐츠를 쿼리로 사용해요. Search After/Point in Time 쿼리는 유효한 'sort' 필드를 포함해야 해요.

태그

elasticsearch, elasticsearch7, elasticsearch8, elasticsearch9, json, page, query, read, scroll

입력 요구 사항 (Input Requirement)

REQUIRED — 입력 FlowFile이 필요해요.

민감한 동적 속성 지원 (Supports Sensitive Dynamic Properties)

false — 지원하지 않아요.

속성 (Properties)

속성 설명
Aggregation Results Format 집계 출력의 형식이에요.
Aggregation Results Split 모든 집계를 담은 flowfile 하나를 출력할지, 개별 집계마다 flowfile 하나씩 출력할지 정해요.
Aggregations JSON 구문으로 된 하나 이상의 쿼리 집계('aggs')예요. 예: {"items": {"terms": {"field": "product", "size": 10}}}
Client Service 쿼리를 실행하는 데 사용할 Elasticsearch 클라이언트 서비스예요.
Fields 검색할 인덱스 문서의 필드들이에요. JSON 구문이에요. 예: ["user.id", "http.response.*", {"field": "@timestamp", "format": "epoch_millis"}]
Index 사용할 인덱스의 이름이에요.
Max JSON Field String Length JSON 문서나 속성을 파싱할 때 문자열 값의 최대 허용 길이예요.
Output No Hits 쿼리에 대한 hit이 없어도 'hits' flowfile을 출력할지 여부예요. true면 'aggregations'가 출력되더라도 빈 'hits' flowfile이 출력돼요.
Pagination Keep Alive 페이지네이션 'keep_alive' 기간이에요. Elasticsearch가 페이지 사이의 요청 간격 동안 scroll/pit 커서를 살려두는 기간이에요. (모든 페이지가 반환될 때까지의 시간이 아니라 페이지 조회 사이 요청의 최대 허용 시간이에요.)
Pagination Type 사용할 페이지네이션 방식이에요. 모든 방식이 모든 Elasticsearch 버전에서 사용 가능한 것은 아니므로, 서비스에 적합하고 권장되는 방식을 Elasticsearch 문서에서 확인하세요.
Query Lucene 구문이 아닌 JSON 구문의 쿼리예요. 예: {"query":{"match":{"somefield":"somevalue"}}}. 이 매개변수가 설정되지 않으면 쿼리는 flowfile 콘텐츠에서 읽혀요. 쿼리(속성 및 flowfile 콘텐츠)가 비어 있으면 기본 빈 JSON Object가 사용되며, 이는 Elasticsearch에서 'match_all' 쿼리가 돼요.
Query Attribute 설정하면 실행된 쿼리가 각 결과 flowfile의 지정된 속성에 설정돼요.
Query Clause Lucene 구문이 아닌 JSON 구문의 'query' 절이에요. 예: {"match":{"somefield":"somevalue"}}. 쿼리가 비어 있으면 기본 JSON Object가 사용되며 Elasticsearch에서 'match_all' 쿼리가 돼요.
Query Definition Style 프로세서가 사용할 JSON Query 정의 방식이에요.
Script Fields 쿼리 실행 시점에 script 평가로 만들 필드들이에요. JSON 구문이에요. 예: {"test1": {"script": {"lang": "painless", "source": "doc['price'].value * 2"}}, "test2": {"script": {"lang": "painless", "source": "doc['price'].value * params.factor", "params": {"factor": 2.0}}}}
Search Results Format Hits 출력의 형식이에요.
Search Results Split 모든 hit을 담은 flowfile 하나를 출력할지, 개별 hit마다 flowfile 하나를 출력할지, 또는 모든 페이지 응답의 모든 hit을 담은 flowfile 하나를 출력할지 정해요.
Size 쿼리에서 검색할 최대 문서 수예요. 쿼리가 페이지네이션되면 이 'size'는 전체 결과 집합의 'size'가 아니라 쿼리의 각 페이지에 적용돼요.
Sort JSON 구문으로 하나 이상의 필드로 결과를 정렬해요. 예: [{"price": {"order": "asc", "mode": "avg"}}, {"post_date": {"format": "strict_date_optional_time_nanos"}}]
Type 이 문서의 유형이에요(Elasticsearch에서 인덱싱과 검색에 사용).

관계 (Relationships)

이름 설명
aggregations 집계가 이 관계로 라우팅돼요.
failure 서버 가용성과 무관한 이유로 실패한 모든 flowfile이 이 관계로 이동해요.
hits 검색 hit이 이 관계로 라우팅돼요.
original 오류를 일으키지 않는 모든 원본 flowfile이 이 관계로 이동해요.

쓰기 속성 (Writes attributes)

이름 설명
mime.type application/json
aggregation.name 출력 flowfile에 결과가 담긴 집계의 이름이에요.
aggregation.number 출력 flowfile에 결과가 담긴 집계의 번호예요.
page.number 결과가 반환된 페이지(요청)의 번호로 1부터 시작해요.
hit.count 출력 flowfile에 있는 hit의 수예요.
elasticsearch.query.error 인덱스 쿼리 중 오류가 있을 때 Elasticsearch가 제공한 오류 메시지예요.

더 보기 (See also)

  • org.apache.nifi.processors.elasticsearch.ConsumeElasticsearch
  • org.apache.nifi.processors.elasticsearch.JsonQueryElasticsearch
  • org.apache.nifi.processors.elasticsearch.SearchElasticsearch

더 알아보기 (Learn more)