Skip to content

Commit

Permalink
Updated the API from the newest spec (#869)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhtruong authored Sep 10, 2024
1 parent b1c91eb commit bd23559
Show file tree
Hide file tree
Showing 167 changed files with 3,657 additions and 755 deletions.
127 changes: 123 additions & 4 deletions api/OpenSearchAPI.d.ts

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions api/OpenSearchAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ class OpenSearchAPI {
constructor (opts) {
this[kConfigErr] = opts.ConfigurationError
this[kApiModules] = {
asynchronousSearch: new(require('./asynchronousSearch/_api'))(this),
cat: new(require('./cat/_api'))(this),
cluster: new(require('./cluster/_api'))(this),
danglingIndices: new(require('./danglingIndices/_api'))(this),
flowFramework: new(require('./flowFramework/_api'))(this),
http: new(require('./http/_api'))(this),
indices: new(require('./indices/_api'))(this),
ingest: new(require('./ingest/_api'))(this),
knn: new(require('./knn/_api'))(this),
ml: new(require('./ml/_api'))(this),
nodes: new(require('./nodes/_api'))(this),
notifications: new(require('./notifications/_api'))(this),
observability: new(require('./observability/_api'))(this),
ppl: new(require('./ppl/_api'))(this),
query: new(require('./query/_api'))(this),
remoteStore: new(require('./remoteStore/_api'))(this),
rollups: new(require('./rollups/_api'))(this),
searchPipeline: new(require('./searchPipeline/_api'))(this),
Expand Down Expand Up @@ -140,17 +144,21 @@ class OpenSearchAPI {

// Setup API Modules
Object.defineProperties(this, {
asynchronousSearch: { get() { return this[kApiModules].asynchronousSearch } },
cat: { get() { return this[kApiModules].cat } },
cluster: { get() { return this[kApiModules].cluster } },
danglingIndices: { get() { return this[kApiModules].danglingIndices } },
flowFramework: { get() { return this[kApiModules].flowFramework } },
http: { get() { return this[kApiModules].http } },
indices: { get() { return this[kApiModules].indices } },
ingest: { get() { return this[kApiModules].ingest } },
knn: { get() { return this[kApiModules].knn } },
ml: { get() { return this[kApiModules].ml } },
nodes: { get() { return this[kApiModules].nodes } },
notifications: { get() { return this[kApiModules].notifications } },
observability: { get() { return this[kApiModules].observability } },
ppl: { get() { return this[kApiModules].ppl } },
query: { get() { return this[kApiModules].query } },
remoteStore: { get() { return this[kApiModules].remoteStore } },
rollups: { get() { return this[kApiModules].rollups } },
searchPipeline: { get() { return this[kApiModules].searchPipeline } },
Expand All @@ -160,8 +168,12 @@ class OpenSearchAPI {
tasks: { get() { return this[kApiModules].tasks } },
transforms: { get() { return this[kApiModules].transforms } },

// Deprecated: Use asynchronousSearch instead.
asynchronous_search: { get() { return this[kApiModules].asynchronousSearch } },
// Deprecated: Use danglingIndices instead.
dangling_indices: { get() { return this[kApiModules].danglingIndices } },
// Deprecated: Use flowFramework instead.
flow_framework: { get() { return this[kApiModules].flowFramework } },
// Deprecated: Use remoteStore instead.
remote_store: { get() { return this[kApiModules].remoteStore } },
// Deprecated: Use searchPipeline instead.
Expand Down
1 change: 1 addition & 0 deletions api/_core/count.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ export interface Count_Response extends ApiResponse {
export interface Count_ResponseBody {
_shards: Common.ShardStatistics;
count: number;
terminated_early?: boolean;
}

2 changes: 1 addition & 1 deletion api/_core/deleteByQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const { normalizeArguments, parsePathParam, handleMissingParam } = require('../u
* @param {number} [params.scroll_size=100] - Size of the scroll request that powers the operation.
* @param {string} [params.search_timeout] - Explicit timeout for each search request. Defaults to no timeout.
* @param {string} [params.search_type] - The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`.
* @param {integer} [params.size] - Deprecated, please use `max_docs` instead.
* @param {number} [params.size] - Deprecated, please use `max_docs` instead.
* @param {string} [params.slices] - The number of slices this task should be divided into.
* @param {array} [params.sort] - A comma-separated list of <field>:<direction> pairs.
* @param {array} [params.stats] - Specific `tag` of the request for logging and statistical purposes.
Expand Down
2 changes: 1 addition & 1 deletion api/_core/reindex.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ documents from a remote cluster.
* @memberOf API-Core
*
* @param {object} params
* @param {integer} [params.max_docs] - Maximum number of documents to process. By default, all documents.
* @param {number} [params.max_docs] - Maximum number of documents to process. By default, all documents.
* @param {boolean} [params.refresh] - If `true`, the request refreshes affected shards to make this operation visible to search.
* @param {number} [params.requests_per_second=0] - The throttle for this request in sub-requests per second. Defaults to no throttle.
* @param {string} [params.scroll] - Specifies how long a consistent view of the index should be maintained for scrolled search.
Expand Down
2 changes: 1 addition & 1 deletion api/_core/search.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface Search_RequestBody {
from?: number;
highlight?: Core_Search.Highlight;
indices_boost?: Record<string, number>[];
knn?: Common.KnnQuery | Common.KnnQuery[];
knn?: Common_QueryDsl.KnnQuery | Common_QueryDsl.KnnQuery[];
min_score?: number;
pit?: Core_Search.PointInTimeReference;
post_filter?: Common_QueryDsl.QueryContainer;
Expand Down
2 changes: 1 addition & 1 deletion api/_core/updateByQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ for example to pick up a mapping change.
* @param {number} [params.scroll_size=100] - Size of the scroll request that powers the operation.
* @param {string} [params.search_timeout] - Explicit timeout for each search request.
* @param {string} [params.search_type] - The type of the search operation. Available options: `query_then_fetch`, `dfs_query_then_fetch`.
* @param {integer} [params.size] - Deprecated, please use `max_docs` instead.
* @param {number} [params.size] - Deprecated, please use `max_docs` instead.
* @param {string} [params.slices] - The number of slices this task should be divided into.
* @param {array} [params.sort] - A comma-separated list of <field>:<direction> pairs.
* @param {array} [params.stats] - Specific `tag` of the request for logging and statistical purposes.
Expand Down
Loading

0 comments on commit bd23559

Please sign in to comment.