elasticlink 0.6.0-beta → 0.7.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,6 +24,7 @@ elasticlink simplifies building Elasticsearch queries and index management in Ty
24
24
 
25
25
  | elasticlink | Node.js | Elasticsearch |
26
26
  |-------------|-------------|---------------|
27
+ | 0.7.0-beta | 20, 22, 24 | 9.x (≥9.0.0) |
27
28
  | 0.6.0-beta | 20, 22, 24 | 9.x (≥9.0.0) |
28
29
  | 0.5.0-beta | 20, 22, 24 | 9.x (≥9.0.0) |
29
30
  | 0.4.0-beta | 20, 22, 24 | 9.x (≥9.0.0) |
@@ -185,7 +186,7 @@ Aggregations can be combined with queries or used standalone:
185
186
 
186
187
  - **Bucket**: `terms()`, `dateHistogram()`, `histogram()`, `range()`
187
188
  - **Metric**: `avg()`, `sum()`, `min()`, `max()`, `cardinality()`, `percentiles()`, `stats()`, `valueCount()`
188
- - **Composition**: `subAgg()` for nested aggregations
189
+ - **Composition**: `subAgg()` for nested aggregations — attaches sub-aggregations to the **last** aggregation defined before the call; chain order matters
189
190
 
190
191
  ```typescript
191
192
  import { query, aggregations } from 'elasticlink';
@@ -286,12 +287,14 @@ const hybridSearch = query(productWithEmbeddingMappings)
286
287
  ```
287
288
 
288
289
  **Common Vector Dimensions:**
290
+
289
291
  - **384-768**: Sentence transformers (all-MiniLM, all-mpnet)
290
292
  - **512**: Image embeddings (ResNet, ViT)
291
293
  - **1536**: OpenAI text-embedding-ada-002
292
294
  - **3072**: OpenAI text-embedding-3-large
293
295
 
294
296
  **Dense Vector Field Mapping Example:**
297
+
295
298
  ```typescript
296
299
  import type { DenseVectorOptions } from 'elasticlink';
297
300
 
@@ -347,6 +350,7 @@ const customScored = query(scoredProductMappings)
347
350
  ```
348
351
 
349
352
  **Script Languages:**
353
+
350
354
  - **painless** (default): Elasticsearch's primary scripting language
351
355
  - **expression**: Fast, limited expression language
352
356
  - **mustache**: Template-based scripting
@@ -1,6 +1,6 @@
1
1
  import type { FieldTypeString } from './index-management.types.js';
2
2
  import type { MappingsSchema } from './mapping.types.js';
3
- import { AggregationBuilder, AggregationState } from './aggregation.types.js';
4
- export declare const createAggregationBuilder: <M extends Record<string, FieldTypeString>>(state?: AggregationState) => AggregationBuilder<M>;
5
- export declare const aggregations: <M extends Record<string, FieldTypeString>>(_schema: MappingsSchema<M>) => AggregationBuilder<M>;
3
+ import type { RootAggregationBuilder, AggregationState } from './aggregation.types.js';
4
+ export declare function createAggregationBuilder<M extends Record<string, FieldTypeString>>(state?: AggregationState): RootAggregationBuilder<M>;
5
+ export declare const aggregations: <M extends Record<string, FieldTypeString>>(_schema: MappingsSchema<M>) => RootAggregationBuilder<M>;
6
6
  //# sourceMappingURL=aggregation.builder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregation.builder.d.ts","sourceRoot":"","sources":["../src/aggregation.builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAajB,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,wBAAwB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAChF,QAAO,gBAAqB,KAC3B,kBAAkB,CAAC,CAAC,CAsKrB,CAAC;AAGH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,SAAS,cAAc,CAAC,CAAC,CAAC,0BACnE,CAAC"}
1
+ {"version":3,"file":"aggregation.builder.d.ts","sourceRoot":"","sources":["../src/aggregation.builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAiC,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EACV,sBAAsB,EAGtB,gBAAgB,EAkBjB,MAAM,wBAAwB,CAAC;AAuHhC,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAChF,KAAK,GAAE,gBAAqB,GAC3B,sBAAsB,CAAC,CAAC,CAAC,CAgB3B;AAED,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,SAAS,cAAc,CAAC,CAAC,CAAC,8BACnE,CAAC"}
@@ -1,155 +1,65 @@
1
- export const createAggregationBuilder = (state = {}) => ({
2
- // Bucket aggregations
3
- terms: (name, field, options) => {
4
- return createAggregationBuilder({
5
- ...state,
6
- [name]: {
7
- terms: {
8
- field,
9
- ...(options && options)
10
- }
11
- }
12
- });
13
- },
14
- dateHistogram: (name, field, options) => {
15
- return createAggregationBuilder({
16
- ...state,
17
- [name]: {
18
- date_histogram: {
19
- field,
20
- ...(options && options)
21
- }
22
- }
23
- });
24
- },
25
- range: (name, field, options) => {
26
- return createAggregationBuilder({
27
- ...state,
28
- [name]: {
29
- range: {
30
- field,
31
- ...(options && options)
32
- }
33
- }
34
- });
35
- },
36
- histogram: (name, field, options) => {
37
- return createAggregationBuilder({
38
- ...state,
39
- [name]: {
40
- histogram: {
41
- field,
42
- ...(options && options)
43
- }
44
- }
45
- });
46
- },
47
- // Metric aggregations
48
- avg: (name, field, options) => {
49
- return createAggregationBuilder({
50
- ...state,
51
- [name]: {
52
- avg: {
53
- field,
54
- ...(options && options)
55
- }
56
- }
57
- });
58
- },
59
- sum: (name, field, options) => {
60
- return createAggregationBuilder({
61
- ...state,
62
- [name]: {
63
- sum: {
64
- field,
65
- ...(options && options)
66
- }
67
- }
68
- });
69
- },
70
- min: (name, field, options) => {
71
- return createAggregationBuilder({
72
- ...state,
73
- [name]: {
74
- min: {
75
- field,
76
- ...(options && options)
77
- }
78
- }
79
- });
80
- },
81
- max: (name, field, options) => {
82
- return createAggregationBuilder({
83
- ...state,
84
- [name]: {
85
- max: {
86
- field,
87
- ...(options && options)
88
- }
89
- }
90
- });
91
- },
92
- cardinality: (name, field, options) => {
93
- return createAggregationBuilder({
94
- ...state,
95
- [name]: {
96
- cardinality: {
97
- field,
98
- ...(options && options)
99
- }
100
- }
101
- });
102
- },
103
- percentiles: (name, field, options) => {
104
- return createAggregationBuilder({
105
- ...state,
106
- [name]: {
107
- percentiles: {
108
- field,
109
- ...(options && options)
110
- }
111
- }
112
- });
113
- },
114
- stats: (name, field, options) => {
115
- return createAggregationBuilder({
116
- ...state,
117
- [name]: {
118
- stats: {
119
- field,
120
- ...(options && options)
121
- }
122
- }
123
- });
124
- },
125
- valueCount: (name, field, options) => {
126
- return createAggregationBuilder({
127
- ...state,
128
- [name]: {
129
- value_count: {
130
- field,
131
- ...(options && options)
132
- }
133
- }
134
- });
135
- },
136
- // Sub-aggregations
137
- subAgg: (fn) => {
138
- const keys = Object.keys(state);
139
- const lastKey = keys.at(-1);
140
- const { [lastKey]: lastAgg } = state;
141
- const subAggs = fn(createAggregationBuilder({})).build();
142
- return createAggregationBuilder({
143
- ...state,
144
- [lastKey]: {
145
- ...lastAgg,
146
- aggs: subAggs
147
- }
148
- });
149
- },
150
- // Build
1
+ // Shared metric/bucket method implementations return type is `any` so the same code
2
+ // can be spread into RootAggregationBuilder, NestedEntryBuilder, and NestedAggregationBuilder.
3
+ // The actual return-type contracts are enforced by the public factory return-type annotations.
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ const sharedAggMethods = (state, rebuild) => ({
6
+ terms: (name, field, options) => rebuild({ ...state, [name]: { terms: { field, ...(options ?? {}) } } }),
7
+ dateHistogram: (name, field, options) => rebuild({ ...state, [name]: { date_histogram: { field, ...(options ?? {}) } } }),
8
+ range: (name, field, options) => rebuild({ ...state, [name]: { range: { field, ...(options ?? {}) } } }),
9
+ histogram: (name, field, options) => rebuild({ ...state, [name]: { histogram: { field, ...(options ?? {}) } } }),
10
+ avg: (name, field, options) => rebuild({ ...state, [name]: { avg: { field, ...(options ?? {}) } } }),
11
+ sum: (name, field, options) => rebuild({ ...state, [name]: { sum: { field, ...(options ?? {}) } } }),
12
+ min: (name, field, options) => rebuild({ ...state, [name]: { min: { field, ...(options ?? {}) } } }),
13
+ max: (name, field, options) => rebuild({ ...state, [name]: { max: { field, ...(options ?? {}) } } }),
14
+ cardinality: (name, field, options) => rebuild({ ...state, [name]: { cardinality: { field, ...(options ?? {}) } } }),
15
+ percentiles: (name, field, options) => rebuild({ ...state, [name]: { percentiles: { field, ...(options ?? {}) } } }),
16
+ stats: (name, field, options) => rebuild({ ...state, [name]: { stats: { field, ...(options ?? {}) } } }),
17
+ valueCount: (name, field, options) => rebuild({ ...state, [name]: { value_count: { field, ...(options ?? {}) } } }),
18
+ extendedStats: (name, field, options) => rebuild({ ...state, [name]: { extended_stats: { field, ...(options ?? {}) } } }),
19
+ topHits: (name, options) => rebuild({ ...state, [name]: { top_hits: { ...(options ?? {}) } } }),
20
+ autoDateHistogram: (name, field, options) => rebuild({ ...state, [name]: { auto_date_histogram: { field, ...(options ?? {}) } } }),
21
+ composite: (name, sources, options) => rebuild({ ...state, [name]: { composite: { sources, ...(options ?? {}) } } }),
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
+ filter: (name, query) => rebuild({ ...state, [name]: { filter: query } }),
151
24
  // eslint-disable-next-line functional/functional-parameters
152
25
  build: () => state
153
26
  });
154
- // Helper function to create aggregations without needing to import the builder
27
+ const attachSubAgg = (state, subAggState) => {
28
+ const lastKey = Object.keys(state).at(-1);
29
+ const existing = state[lastKey].aggs ?? {};
30
+ return { ...state, [lastKey]: { ...state[lastKey], aggs: { ...existing, ...subAggState } } };
31
+ };
32
+ // Function declarations are used for the internal factories (vs const arrows) so that mutual
33
+ // recursion between createNestedEntryBuilder and createNestedAggregationBuilder is hoisted.
34
+ function createNestedEntryBuilder(state,
35
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
+ rebuild
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ ) {
39
+ return {
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
+ ...sharedAggMethods(state, rebuild),
42
+ global: (name) => createAggregationBuilder({ ...state, [name]: { global: {} } }),
43
+ nested: (name, path) => createNestedEntryBuilder({ ...state, [name]: { nested: { path } } }, rebuild),
44
+ subAgg: (fn) => rebuild(attachSubAgg(state, fn(createNestedAggregationBuilder()).build()))
45
+ };
46
+ }
47
+ function createNestedAggregationBuilder(state = {}) {
48
+ return {
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
+ ...sharedAggMethods(state, (createNestedAggregationBuilder)),
51
+ nested: (name, path) => createNestedEntryBuilder({ ...state, [name]: { nested: { path } } }, (createNestedAggregationBuilder)),
52
+ reverseNested: (name, path) => createNestedAggregationBuilder({ ...state, [name]: { reverse_nested: path ? { path } : {} } }),
53
+ subAgg: (fn) => createNestedAggregationBuilder(attachSubAgg(state, fn(createNestedAggregationBuilder()).build()))
54
+ };
55
+ }
56
+ export function createAggregationBuilder(state = {}) {
57
+ return {
58
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
+ ...sharedAggMethods(state, (createAggregationBuilder)),
60
+ global: (name) => createAggregationBuilder({ ...state, [name]: { global: {} } }),
61
+ nested: (name, path) => createNestedEntryBuilder({ ...state, [name]: { nested: { path } } }, (createAggregationBuilder)),
62
+ subAgg: (fn) => createAggregationBuilder(attachSubAgg(state, fn(createAggregationBuilder()).build()))
63
+ };
64
+ }
155
65
  export const aggregations = (_schema) => createAggregationBuilder();
@@ -3,9 +3,9 @@
3
3
  * Derived from official @elastic/elasticsearch types for accuracy and completeness.
4
4
  * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html
5
5
  */
6
- import type { AggregationsTermsAggregation, AggregationsDateHistogramAggregation, AggregationsRangeAggregation, AggregationsHistogramAggregation, AggregationsAverageAggregation, AggregationsSumAggregation, AggregationsMinAggregation, AggregationsMaxAggregation, AggregationsCardinalityAggregation, AggregationsPercentilesAggregation, AggregationsStatsAggregation, AggregationsValueCountAggregation, AggregationsCalendarInterval } from '@elastic/elasticsearch/lib/api/types';
6
+ import type { AggregationsTermsAggregation, AggregationsDateHistogramAggregation, AggregationsRangeAggregation, AggregationsHistogramAggregation, AggregationsAverageAggregation, AggregationsSumAggregation, AggregationsMinAggregation, AggregationsMaxAggregation, AggregationsCardinalityAggregation, AggregationsPercentilesAggregation, AggregationsStatsAggregation, AggregationsValueCountAggregation, AggregationsCalendarInterval, AggregationsExtendedStatsAggregation, AggregationsTopHitsAggregation, AggregationsAutoDateHistogramAggregation, AggregationsCompositeAggregation, AggregationsCompositeAggregationSource } from '@elastic/elasticsearch/lib/api/types';
7
7
  import type { FieldTypeString } from './index-management.types.js';
8
- import type { DateFields, NumericFields } from './mapping.types.js';
8
+ import type { DateFields, NumericFields, KeywordFields, BooleanFields, IpFields, NestedPathFields, SubFieldsOf } from './mapping.types.js';
9
9
  /**
10
10
  * Options for terms aggregation (excludes 'field' which is handled by the builder)
11
11
  * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html
@@ -71,6 +71,30 @@ export type StatsAggOptions = Omit<AggregationsStatsAggregation, 'field'>;
71
71
  * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-valuecount-aggregation.html
72
72
  */
73
73
  export type ValueCountAggOptions = Omit<AggregationsValueCountAggregation, 'field'>;
74
+ /**
75
+ * Options for extended_stats aggregation (excludes 'field' which is handled by the builder)
76
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-extendedstats-aggregation.html
77
+ */
78
+ export type ExtendedStatsAggOptions = Omit<AggregationsExtendedStatsAggregation, 'field'>;
79
+ /**
80
+ * Options for top_hits aggregation
81
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html
82
+ */
83
+ export type TopHitsAggOptions = AggregationsTopHitsAggregation;
84
+ /**
85
+ * Options for auto_date_histogram aggregation (excludes 'field' which is handled by the builder)
86
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-autodatehistogram-aggregation.html
87
+ */
88
+ export type AutoDateHistogramAggOptions = Omit<AggregationsAutoDateHistogramAggregation, 'field'>;
89
+ /**
90
+ * Source entry for composite aggregation — a named single-value source definition
91
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-composite-aggregation.html
92
+ */
93
+ export type CompositeAggSource = Record<string, AggregationsCompositeAggregationSource>;
94
+ /**
95
+ * Options for composite aggregation (excludes 'sources' which is handled by the builder)
96
+ */
97
+ export type CompositeAggOptions = Omit<AggregationsCompositeAggregation, 'sources'>;
74
98
  /**
75
99
  * Aggregation state for build output
76
100
  */
@@ -78,36 +102,72 @@ export type AggregationState = {
78
102
  [key: string]: any;
79
103
  };
80
104
  /**
81
- * Aggregation builder interface
82
- */
83
- export type AggregationBuilder<M extends Record<string, FieldTypeString>> = {
84
- /** Terms aggregation - group by field values */
85
- terms: <K extends string & keyof M>(name: string, field: K, options?: TermsAggOptions) => AggregationBuilder<M>;
86
- /** Date histogram aggregation - group by time intervals */
87
- dateHistogram: <K extends DateFields<M> & string>(name: string, field: K, options?: DateHistogramAggOptions) => AggregationBuilder<M>;
88
- /** Range aggregation - group by numeric/date ranges */
89
- range: <K extends string & keyof M>(name: string, field: K, options?: RangeAggOptions) => AggregationBuilder<M>;
90
- /** Histogram aggregation - group by numeric intervals */
91
- histogram: <K extends NumericFields<M> & string>(name: string, field: K, options?: HistogramAggOptions) => AggregationBuilder<M>;
92
- /** Average aggregation */
93
- avg: <K extends NumericFields<M> & string>(name: string, field: K, options?: AvgAggOptions) => AggregationBuilder<M>;
94
- /** Sum aggregation */
95
- sum: <K extends NumericFields<M> & string>(name: string, field: K, options?: SumAggOptions) => AggregationBuilder<M>;
96
- /** Minimum value aggregation */
97
- min: <K extends NumericFields<M> & string>(name: string, field: K, options?: MinAggOptions) => AggregationBuilder<M>;
98
- /** Maximum value aggregation */
99
- max: <K extends NumericFields<M> & string>(name: string, field: K, options?: MaxAggOptions) => AggregationBuilder<M>;
100
- /** Cardinality aggregation - count unique values */
101
- cardinality: <K extends string & keyof M>(name: string, field: K, options?: CardinalityAggOptions) => AggregationBuilder<M>;
102
- /** Percentiles aggregation */
103
- percentiles: <K extends NumericFields<M> & string>(name: string, field: K, options?: PercentilesAggOptions) => AggregationBuilder<M>;
104
- /** Statistics aggregation (count, min, max, avg, sum) */
105
- stats: <K extends NumericFields<M> & string>(name: string, field: K, options?: StatsAggOptions) => AggregationBuilder<M>;
106
- /** Value count aggregation */
107
- valueCount: <K extends string & keyof M>(name: string, field: K, options?: ValueCountAggOptions) => AggregationBuilder<M>;
108
- /** Add sub-aggregation to parent bucket aggregation */
109
- subAgg: (fn: (agg: AggregationBuilder<M>) => AggregationBuilder<M>) => AggregationBuilder<M>;
110
- /** Build aggregation DSL */
105
+ * Shared metric and bucket aggregation methods.
106
+ * `Self` is the return type for each method — varies by context (root vs nested).
107
+ */
108
+ export type BaseAggMethods<M extends Record<string, FieldTypeString>, Self> = {
109
+ terms: <K extends (KeywordFields<M> | NumericFields<M> | BooleanFields<M> | IpFields<M>) & string>(name: string, field: K, options?: TermsAggOptions) => Self;
110
+ dateHistogram: <K extends DateFields<M> & string>(name: string, field: K, options?: DateHistogramAggOptions) => Self;
111
+ range: <K extends (NumericFields<M> | DateFields<M>) & string>(name: string, field: K, options?: RangeAggOptions) => Self;
112
+ histogram: <K extends NumericFields<M> & string>(name: string, field: K, options?: HistogramAggOptions) => Self;
113
+ avg: <K extends NumericFields<M> & string>(name: string, field: K, options?: AvgAggOptions) => Self;
114
+ sum: <K extends NumericFields<M> & string>(name: string, field: K, options?: SumAggOptions) => Self;
115
+ min: <K extends NumericFields<M> & string>(name: string, field: K, options?: MinAggOptions) => Self;
116
+ max: <K extends NumericFields<M> & string>(name: string, field: K, options?: MaxAggOptions) => Self;
117
+ cardinality: <K extends string & keyof M>(name: string, field: K, options?: CardinalityAggOptions) => Self;
118
+ percentiles: <K extends NumericFields<M> & string>(name: string, field: K, options?: PercentilesAggOptions) => Self;
119
+ stats: <K extends NumericFields<M> & string>(name: string, field: K, options?: StatsAggOptions) => Self;
120
+ valueCount: <K extends string & keyof M>(name: string, field: K, options?: ValueCountAggOptions) => Self;
121
+ extendedStats: <K extends NumericFields<M> & string>(name: string, field: K, options?: ExtendedStatsAggOptions) => Self;
122
+ topHits: (name: string, options?: TopHitsAggOptions) => Self;
123
+ autoDateHistogram: <K extends DateFields<M> & string>(name: string, field: K, options?: AutoDateHistogramAggOptions) => Self;
124
+ composite: (name: string, sources: CompositeAggSource[], options?: CompositeAggOptions) => Self;
125
+ filter: (name: string, query: Record<string, any>) => Self;
111
126
  build: () => AggregationState;
112
127
  };
128
+ /**
129
+ * Root-level aggregation builder. Supports `global` and `nested`; does not expose `reverseNested`.
130
+ *
131
+ * Declared as an `interface` (not a `type` alias) so that TypeScript's lazy interface resolution
132
+ * handles the 3-way mutual recursion between `RootAggregationBuilder`, `NestedEntryBuilder`,
133
+ * and `NestedAggregationBuilder` without triggering TS2456 (circular type alias).
134
+ */
135
+ export interface RootAggregationBuilder<M extends Record<string, FieldTypeString>> extends BaseAggMethods<M, RootAggregationBuilder<M>> {
136
+ /** Global aggregation — escapes the current filter context to aggregate across all documents.
137
+ * @remarks Only valid at the root aggregation level, not inside a nested context. */
138
+ global: (name: string) => RootAggregationBuilder<M>;
139
+ /** Nested aggregation — enters a nested document context for aggregating nested fields.
140
+ * Returns a `NestedEntryBuilder` whose `subAgg` callback receives the nested sub-field types. */
141
+ nested: <K extends NestedPathFields<M> & string>(name: string, path: K) => NestedEntryBuilder<M, SubFieldsOf<M, K>, RootAggregationBuilder<M>, M>;
142
+ /** Add sub-aggregation to the last bucket aggregation */
143
+ subAgg: (fn: (agg: RootAggregationBuilder<M>) => RootAggregationBuilder<M>) => RootAggregationBuilder<M>;
144
+ }
145
+ /**
146
+ * Returned by `.nested()` on a root or nested builder.
147
+ *
148
+ * Dual-context design: metric/bucket helpers inherited from `BaseAggMethods<M, R>` operate
149
+ * on the parent field map `M` (sibling aggregations), while the `subAgg` callback is typed
150
+ * to `NestedAggregationBuilder<N>`, giving it access only to the nested sub-fields `N`.
151
+ *
152
+ * `R` is the parent context — `RootAggregationBuilder<M>` when called from root,
153
+ * `NestedAggregationBuilder<M>` when called from inside a nested context.
154
+ */
155
+ export interface NestedEntryBuilder<M extends Record<string, FieldTypeString>, N extends Record<string, FieldTypeString>, R = RootAggregationBuilder<M>, Root extends Record<string, FieldTypeString> = M> extends BaseAggMethods<M, R> {
156
+ global: (name: string) => RootAggregationBuilder<M>;
157
+ nested: <K extends NestedPathFields<M> & string>(name: string, path: K) => NestedEntryBuilder<M, SubFieldsOf<M, K>, R, Root>;
158
+ subAgg: (fn: (agg: NestedAggregationBuilder<N, Root>) => NestedAggregationBuilder<N, Root>) => R;
159
+ }
160
+ /**
161
+ * Nested-context aggregation builder. Supports `reverseNested` and nested-level `nested`;
162
+ * does not expose `global`.
163
+ */
164
+ export interface NestedAggregationBuilder<N extends Record<string, FieldTypeString>, Root extends Record<string, FieldTypeString> = N> extends BaseAggMethods<N, NestedAggregationBuilder<N, Root>> {
165
+ /** Nested aggregation within a nested context — supports multi-level nesting */
166
+ nested: <K extends NestedPathFields<N> & string>(name: string, path: K) => NestedEntryBuilder<N, SubFieldsOf<N, K>, NestedAggregationBuilder<N, Root>, Root>;
167
+ /** Reverse nested aggregation — returns from a nested context back to the root document.
168
+ * @remarks Only valid inside a nested aggregation context. */
169
+ reverseNested: (name: string, path?: string) => NestedAggregationBuilder<Root, Root>;
170
+ /** Add sub-aggregation to the last bucket aggregation */
171
+ subAgg: (fn: (agg: NestedAggregationBuilder<N, Root>) => NestedAggregationBuilder<N, Root>) => NestedAggregationBuilder<N, Root>;
172
+ }
113
173
  //# sourceMappingURL=agg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AM,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,wBAAwB,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,wBAAwB,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;CAClG;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB,CACvC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EACzC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,CAAC,CAChD,SAAQ,cAAc,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC5D,gFAAgF;IAChF,MAAM,EAAE,CAAC,CAAC,SAAS,gBAAgB,CAAC,CAAC,CAAC,GAAG,MAAM,EAC7C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,KACJ,kBAAkB,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IAEvF;kEAC8D;IAC9D,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAErF,yDAAyD;IACzD,MAAM,EAAE,CACN,EAAE,EAAE,CAAC,GAAG,EAAE,wBAAwB,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,wBAAwB,CAAC,CAAC,EAAE,IAAI,CAAC,KAC9E,wBAAwB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;CACxC"}
@@ -13,7 +13,7 @@
13
13
  * embedding: denseVector({ dims: 384 }),
14
14
  * });
15
15
  */
16
- import type { TextFieldOptions, KeywordFieldOptions, NumericFieldOptions, ScaledFloatFieldOptions, DateFieldOptions, BooleanFieldOptions, DenseVectorFieldOptions, ObjectFieldOptions, CompletionFieldOptions, GeoPointFieldOptions, GeoShapeFieldOptions, AliasFieldOptions, IpFieldOptions, RangeFieldOptions, MatchOnlyTextFieldOptions, SearchAsYouTypeFieldOptions, ConstantKeywordFieldOptions, WildcardFieldOptions, FlattenedFieldOptions, FieldMappingWithLiteralType, TextFieldMapping, KeywordFieldMapping, LongFieldMapping, IntegerFieldMapping, ShortFieldMapping, ByteFieldMapping, DoubleFieldMapping, FloatFieldMapping, HalfFloatFieldMapping, ScaledFloatFieldMapping, DateFieldMapping, BooleanFieldMapping, BinaryFieldMapping, IpFieldMapping, DenseVectorFieldMapping, GeoPointFieldMapping, GeoShapeFieldMapping, CompletionFieldMapping, TypedNestedFieldMapping, TypedObjectFieldMapping, AliasFieldMapping, PercolatorFieldMapping, IntegerRangeFieldMapping, FloatRangeFieldMapping, LongRangeFieldMapping, DoubleRangeFieldMapping, DateRangeFieldMapping, MatchOnlyTextFieldMapping, SearchAsYouTypeFieldMapping, ConstantKeywordFieldMapping, WildcardFieldMapping, FlattenedFieldMapping } from './field.types.js';
16
+ import type { TextFieldOptions, KeywordFieldOptions, NumericFieldOptions, UnsignedLongFieldOptions, ScaledFloatFieldOptions, DateFieldOptions, BooleanFieldOptions, DenseVectorFieldOptions, SemanticTextFieldOptions, ObjectFieldOptions, CompletionFieldOptions, GeoPointFieldOptions, GeoShapeFieldOptions, AliasFieldOptions, IpFieldOptions, RangeFieldOptions, MatchOnlyTextFieldOptions, SearchAsYouTypeFieldOptions, ConstantKeywordFieldOptions, WildcardFieldOptions, FlattenedFieldOptions, FieldMappingWithLiteralType, TextFieldMapping, KeywordFieldMapping, LongFieldMapping, IntegerFieldMapping, ShortFieldMapping, ByteFieldMapping, DoubleFieldMapping, FloatFieldMapping, HalfFloatFieldMapping, ScaledFloatFieldMapping, DateFieldMapping, BooleanFieldMapping, BinaryFieldMapping, IpFieldMapping, DenseVectorFieldMapping, SparseVectorFieldMapping, SemanticTextFieldMapping, UnsignedLongFieldMapping, GeoPointFieldMapping, GeoShapeFieldMapping, CompletionFieldMapping, TypedNestedFieldMapping, TypedObjectFieldMapping, AliasFieldMapping, PercolatorFieldMapping, IntegerRangeFieldMapping, FloatRangeFieldMapping, LongRangeFieldMapping, DoubleRangeFieldMapping, DateRangeFieldMapping, MatchOnlyTextFieldMapping, SearchAsYouTypeFieldMapping, ConstantKeywordFieldMapping, WildcardFieldMapping, FlattenedFieldMapping } from './field.types.js';
17
17
  export declare const text: (options?: TextFieldOptions) => TextFieldMapping;
18
18
  export declare const keyword: (options?: KeywordFieldOptions) => KeywordFieldMapping;
19
19
  export declare const long: (options?: NumericFieldOptions) => LongFieldMapping;
@@ -61,6 +61,30 @@ export declare const denseVector: (options?: DenseVectorFieldOptions) => DenseVe
61
61
  * .build();
62
62
  */
63
63
  export declare const quantizedDenseVector: (options?: DenseVectorFieldOptions) => DenseVectorFieldMapping;
64
+ /**
65
+ * Sparse vector field — stores token-weight pairs for sparse retrieval (e.g. ELSER/BM25-style models).
66
+ * Complement to `denseVector()`. Query with the `sparse_vector` query.
67
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/sparse-vector.html
68
+ */
69
+ export declare const sparseVector: () => SparseVectorFieldMapping;
70
+ /**
71
+ * Semantic text field (ES 9.x) — ML-powered text field for semantic and hybrid search.
72
+ * Automatically generates and stores embeddings at index time using the configured inference endpoint.
73
+ *
74
+ * @example
75
+ * const schema = mappings({
76
+ * title: text(),
77
+ * body: semanticText({ inference_id: 'my-elser-endpoint' }),
78
+ * });
79
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/semantic-text.html
80
+ */
81
+ export declare const semanticText: (options?: SemanticTextFieldOptions) => SemanticTextFieldMapping;
82
+ /**
83
+ * Unsigned long field (ES 9.0+) — stores unsigned 64-bit integer values (0 to 2^64-1).
84
+ * Use when values exceed the `long` range.
85
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html
86
+ */
87
+ export declare const unsignedLong: (options?: UnsignedLongFieldOptions) => UnsignedLongFieldMapping;
64
88
  export declare const geoPoint: (options?: GeoPointFieldOptions) => GeoPointFieldMapping;
65
89
  export declare const geoShape: (options?: GeoShapeFieldOptions) => GeoShapeFieldMapping;
66
90
  export declare const completion: (options?: CompletionFieldOptions) => CompletionFieldMapping;
@@ -1 +1 @@
1
- {"version":3,"file":"field.helpers.d.ts","sourceRoot":"","sources":["../src/field.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,qBAAqB,EACrB,2BAA2B,EAC3B,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,IAAI,GAAI,UAAU,gBAAgB,KAAG,gBAGhD,CAAC;AACH,eAAO,MAAM,OAAO,GAAI,UAAU,mBAAmB,KAAG,mBAGtD,CAAC;AAGH,eAAO,MAAM,IAAI,GAAI,UAAU,mBAAmB,KAAG,gBAGnD,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;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAGnH;AAGD,eAAO,MAAM,KAAK,GAAI,SAAS,iBAAiB,KAAG,iBAGjD,CAAC;AAIH,eAAO,MAAM,UAAU,QAAO,sBAE5B,CAAC;AAGH,eAAO,MAAM,YAAY,GAAI,UAAU,iBAAiB,KAAG,wBAGzD,CAAC;AACH,eAAO,MAAM,UAAU,GAAI,UAAU,iBAAiB,KAAG,sBAGvD,CAAC;AACH,eAAO,MAAM,SAAS,GAAI,UAAU,iBAAiB,KAAG,qBAGtD,CAAC;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,iBAAiB,KAAG,uBAGxD,CAAC;AACH,eAAO,MAAM,SAAS,GAAI,UAAU,iBAAiB,KAAG,qBAGtD,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,yBAAyB,KAAG,yBAGlE,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,2BAA2B,KAAG,2BAGtE,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,2BAA2B,KAAG,2BAGtE,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,oBAAoB,KAAG,oBAG7D,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,UAAU,qBAAqB,KAAG,qBAG1D,CAAC"}
@@ -113,6 +113,37 @@ export const quantizedDenseVector = (options) => ({
113
113
  ...options,
114
114
  index_options: { type: 'int8_hnsw', ...options?.index_options }
115
115
  });
116
+ /**
117
+ * Sparse vector field — stores token-weight pairs for sparse retrieval (e.g. ELSER/BM25-style models).
118
+ * Complement to `denseVector()`. Query with the `sparse_vector` query.
119
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/sparse-vector.html
120
+ */
121
+ // eslint-disable-next-line functional/functional-parameters
122
+ export const sparseVector = () => ({ type: 'sparse_vector' });
123
+ /**
124
+ * Semantic text field (ES 9.x) — ML-powered text field for semantic and hybrid search.
125
+ * Automatically generates and stores embeddings at index time using the configured inference endpoint.
126
+ *
127
+ * @example
128
+ * const schema = mappings({
129
+ * title: text(),
130
+ * body: semanticText({ inference_id: 'my-elser-endpoint' }),
131
+ * });
132
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/semantic-text.html
133
+ */
134
+ export const semanticText = (options) => ({
135
+ type: 'semantic_text',
136
+ ...options
137
+ });
138
+ /**
139
+ * Unsigned long field (ES 9.0+) — stores unsigned 64-bit integer values (0 to 2^64-1).
140
+ * Use when values exceed the `long` range.
141
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html
142
+ */
143
+ export const unsignedLong = (options) => ({
144
+ type: 'unsigned_long',
145
+ ...options
146
+ });
116
147
  // Geo
117
148
  export const geoPoint = (options) => ({
118
149
  type: 'geo_point',
@@ -53,6 +53,10 @@ export type NumericFieldOptions = {
53
53
  export type ScaledFloatFieldOptions = NumericFieldOptions & {
54
54
  scaling_factor?: number;
55
55
  };
56
+ /** Options for unsigned_long fields — null_value accepts string or number for >MAX_SAFE_INTEGER precision */
57
+ export type UnsignedLongFieldOptions = Omit<NumericFieldOptions, 'null_value'> & {
58
+ null_value?: string | number;
59
+ };
56
60
  /** Options for date fields */
57
61
  export type DateFieldOptions = {
58
62
  boost?: number;
@@ -81,6 +85,18 @@ export type DenseVectorFieldOptions = {
81
85
  index_options?: any;
82
86
  similarity?: 'cosine' | 'dot_product' | 'l2_norm' | 'max_inner_product';
83
87
  };
88
+ /**
89
+ * Options for semantic_text fields (ES 9.x — ML-powered text field for semantic/hybrid search).
90
+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/semantic-text.html
91
+ */
92
+ export type SemanticTextFieldOptions = {
93
+ inference_id?: string;
94
+ search_inference_id?: string;
95
+ model_settings?: {
96
+ task_type?: string;
97
+ [key: string]: unknown;
98
+ };
99
+ };
84
100
  /** Sub-fields for nested and object field types */
85
101
  export type NestedFields = Record<string, FieldMapping>;
86
102
  /** Options for object fields (enabled flag only — sub-fields are the first argument) */
@@ -216,6 +232,9 @@ export type BooleanFieldMapping = TypedFieldMapping<'boolean'>;
216
232
  export type BinaryFieldMapping = TypedFieldMapping<'binary'>;
217
233
  export type IpFieldMapping = TypedFieldMapping<'ip'>;
218
234
  export type DenseVectorFieldMapping = TypedFieldMapping<'dense_vector'>;
235
+ export type SparseVectorFieldMapping = TypedFieldMapping<'sparse_vector'>;
236
+ export type SemanticTextFieldMapping = TypedFieldMapping<'semantic_text'>;
237
+ export type UnsignedLongFieldMapping = TypedFieldMapping<'unsigned_long'>;
219
238
  export type GeoPointFieldMapping = TypedFieldMapping<'geo_point'>;
220
239
  export type GeoShapeFieldMapping = TypedFieldMapping<'geo_shape'>;
221
240
  export type CompletionFieldMapping = TypedFieldMapping<'completion'>;