import type { estypes } from "@elastic/elasticsearch"; import type { opensearchtypes } from "@opensearch-project/opensearch"; import type { FieldValue } from "./fields.js"; import type { SearchIndexProperties } from "./search-index.js"; import type { SearchRequest } from "./query/search-query.js"; export type SearchResponse, Properties extends SearchIndexProperties, Document> = estypes.SearchResponse> & { hits: { hits: { _source: Document; }[]; }; aggregations: AggregationResults; }; type AggregationResults, Properties extends SearchIndexProperties, Document> = Q["aggs"] extends undefined ? undefined : { [aggregationName in keyof Q["aggs"]]: AggregationResult; }; type AggregationResult = Agg extends { terms: opensearchtypes.AggregationsTermsAggregation; } ? { doc_count_error_upper_bound?: number; sum_other_doc_count?: number; buckets: { key: FieldValue; doc_count: number; }[]; } : Agg extends { value_count: opensearchtypes.AggregationsValueCountAggregation; } ? opensearchtypes.AggregationsValueAggregate : opensearchtypes.AggregationsAggregate; export {}; //# sourceMappingURL=search-response.d.ts.map