From 49f9aa8e927de19c45b13cb1a35134b25d936123 Mon Sep 17 00:00:00 2001 From: Theo Nam Truong Date: Thu, 4 Apr 2024 15:08:41 -0600 Subject: [PATCH] Added search_pipeline to search (#716) Signed-off-by: Theo Truong --- CHANGELOG.md | 3 ++- api/api/search.js | 3 +++ api/requestParams.d.ts | 1 + api/types.d.ts | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2d84e254..7bc59584f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `@types/node` from 20.11.25 to 20.12.2 - Bumps `@babel/eslint-parser` from 7.23.10 to 7.24.1 ### Changed +- Added `search_pipeline` ([716](https://github.com/opensearch-project/opensearch-js/pull/716)) ### Deprecated ### Removed ### Fixed @@ -247,4 +248,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Fixed -- Fix mutability of connection headers ([#291](https://github.com/opensearch-project/opensearch-js/issues/291)) \ No newline at end of file +- Fix mutability of connection headers ([#291](https://github.com/opensearch-project/opensearch-js/issues/291)) diff --git a/api/api/search.js b/api/api/search.js index f8e9fc2d9..fd4a75ea3 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -54,6 +54,7 @@ const acceptedQuerystring = [ 'q', 'routing', 'scroll', + 'search_pipeline', 'search_type', 'size', 'sort', @@ -97,6 +98,7 @@ const snakeCase = { ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', + searchPipeline: 'search_pipeline', searchType: 'search_type', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', @@ -148,6 +150,7 @@ const snakeCase = { * @param {string} [params.q] - Query in the Lucene query string syntax * @param {string} [params.routing] - A comma-separated list of specific routing values * @param {string} [params.scroll] - Specify how long a consistent view of the index should be maintained for scrolled search + * @param {string} [params.search_pipeline] - Customizable sequence of processing stages applied to search queries. * @param {string} [params.search_type] - Search operation type (options: query_then_fetch, dfs_query_then_fetch) * @param {number} [params.size] - Number of hits to return (default: 10) * @param {string} [params.sort] - A comma-separated list of : pairs diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 7bc01bc07..1be0ebe25 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -1516,6 +1516,7 @@ export interface Search extends Generic { q?: string; routing?: string | string[]; scroll?: string; + search_pipeline?: string; search_type?: 'query_then_fetch' | 'dfs_query_then_fetch'; size?: number; sort?: string | string[]; diff --git a/api/types.d.ts b/api/types.d.ts index a5be4da5a..e0089dd6b 100644 --- a/api/types.d.ts +++ b/api/types.d.ts @@ -935,6 +935,7 @@ export interface SearchRequest extends RequestBase { request_cache?: boolean; routing?: Routing; scroll?: Time; + search_pipeline?: string; search_type?: SearchType; stats?: string[]; stored_fields?: Fields; @@ -973,6 +974,7 @@ export interface SearchRequest extends RequestBase { query?: QueryDslQueryContainer; rescore?: SearchRescore | SearchRescore[]; script_fields?: Record; + search_pipeline?: Record; search_after?: (integer | string)[]; size?: integer; slice?: SlicedScroll;