diff --git a/packages/nodes-base/nodes/ElasticSearch/ElasticSearch.node.ts b/packages/nodes-base/nodes/ElasticSearch/ElasticSearch.node.ts
index c7082a14d6..6932989a5d 100644
--- a/packages/nodes-base/nodes/ElasticSearch/ElasticSearch.node.ts
+++ b/packages/nodes-base/nodes/ElasticSearch/ElasticSearch.node.ts
@@ -20,6 +20,10 @@ import {
indexOperations,
} from './descriptions';
+import {
+ DocumentGetAllAdditionalFields,
+} from './types';
+
export class ElasticSearch implements INodeType {
description: INodeTypeDescription = {
displayName: 'ElasticSearch',
@@ -132,11 +136,11 @@ export class ElasticSearch implements INodeType {
const body = {} as IDataObject;
const qs = {} as IDataObject;
- const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
+ const additionalFields = this.getNodeParameter('additionalFields', i) as DocumentGetAllAdditionalFields;
if (Object.keys(additionalFields).length) {
const { query, ...rest } = additionalFields;
- Object.assign(body, query);
+ Object.assign(body, JSON.parse(query));
Object.assign(qs, rest);
}
@@ -145,12 +149,9 @@ export class ElasticSearch implements INodeType {
if (!returnAll) {
qs.size = this.getNodeParameter('limit', 0);
}
-
responseData = await elasticSearchApiRequest.call(this, 'GET', `/${indexId}/_search`, body, qs);
responseData = responseData.hits.hits;
- // TODO: Paginate
-
} else if (operation === 'index') {
// ----------------------------------------
diff --git a/packages/nodes-base/nodes/ElasticSearch/GenericFunctions.ts b/packages/nodes-base/nodes/ElasticSearch/GenericFunctions.ts
index c709af4a6d..e7df40ea97 100644
--- a/packages/nodes-base/nodes/ElasticSearch/GenericFunctions.ts
+++ b/packages/nodes-base/nodes/ElasticSearch/GenericFunctions.ts
@@ -51,7 +51,7 @@ export async function elasticSearchApiRequest(
}
try {
- console.log(options);
+ // console.log(options);
return await this.helpers.request(options);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
diff --git a/packages/nodes-base/nodes/ElasticSearch/descriptions/DocumentDescription.ts b/packages/nodes-base/nodes/ElasticSearch/descriptions/DocumentDescription.ts
index f1565d8918..b7e33e1187 100644
--- a/packages/nodes-base/nodes/ElasticSearch/descriptions/DocumentDescription.ts
+++ b/packages/nodes-base/nodes/ElasticSearch/descriptions/DocumentDescription.ts
@@ -352,13 +352,13 @@ export const documentFields = [
typeOptions: {
minValue: 1,
},
- default: 0,
+ default: 1,
},
{
displayName: 'Query',
name: 'query',
description: 'Query in the ElasticSearch Query DSL.',
- type: 'string',
+ type: 'json',
typeOptions: {
alwaysOpenEditWindow: true,
},
@@ -372,13 +372,6 @@ export const documentFields = [
type: 'boolean',
default: false,
},
- {
- displayName: 'Rest Total Hits as Integer',
- name: 'rest_total_hits_as_int',
- description: 'Whether hits.total
should be rendered as an integer or an object in the rest search response. Defaults to false.',
- type: 'boolean',
- default: false,
- },
{
displayName: 'Routing',
name: 'routing',
@@ -410,13 +403,6 @@ export const documentFields = [
type: 'boolean',
default: false,
},
- {
- displayName: 'Size',
- name: 'size',
- description: 'Define the number of hits to return. Defaults to 10.',
- type: 'number',
- default: 10,
- },
{
displayName: 'Sort',
name: 'sort',
@@ -459,20 +445,6 @@ export const documentFields = [
type: 'boolean',
default: false,
},
- {
- displayName: 'Suggest Field',
- name: 'suggest_field',
- description: 'Field to use for suggestions.',
- type: 'string',
- default: '',
- },
- {
- displayName: 'Suggest Text',
- name: 'suggest_text',
- description: 'Source text for which the suggestions should be returned.',
- type: 'string',
- default: '',
- },
{
displayName: 'Terminate After',
name: 'terminate_after',
diff --git a/packages/nodes-base/nodes/ElasticSearch/types.d.ts b/packages/nodes-base/nodes/ElasticSearch/types.d.ts
index 7698775029..04ed7b8da3 100644
--- a/packages/nodes-base/nodes/ElasticSearch/types.d.ts
+++ b/packages/nodes-base/nodes/ElasticSearch/types.d.ts
@@ -3,3 +3,33 @@ export type ElasticSearchApiCredentials = {
password: string;
baseUrl: string;
};
+
+export type DocumentGetAllAdditionalFields = {
+ allow_no_indices: boolean;
+ allow_partial_search_results: boolean;
+ batched_reduce_size: number;
+ ccs_minimize_roundtrips: boolean;
+ docvalue_fields: string;
+ expand_wildcards: 'All' | 'Closed' | 'Hidden' | 'None' | 'Open';
+ explain: boolean;
+ ignore_throttled: boolean;
+ ignore_unavailable: boolean;
+ max_concurrent_shard_requests: number;
+ pre_filter_shard_size: number;
+ query: string;
+ request_cache: boolean;
+ routing: string;
+ search_type: 'query_then_fetch' | 'dfs_query_then_fetch';
+ seq_no_primary_term: boolean;
+ sort: string;
+ _source: boolean;
+ _source_excludes: string;
+ _source_includes: string;
+ stats: string;
+ stored_fields: boolean;
+ terminate_after: boolean;
+ timeout: number;
+ track_scores: boolean;
+ track_total_hits: string;
+ version: boolean;
+}