mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
🎉 Initial node scaffolding
This commit is contained in:
parent
4801510b0c
commit
50ae196768
|
@ -0,0 +1,36 @@
|
||||||
|
import {
|
||||||
|
ICredentialType,
|
||||||
|
NodePropertyTypes,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
export class ElasticSearchApi implements ICredentialType {
|
||||||
|
name = 'elasticSearchApi';
|
||||||
|
displayName = 'Elastic Search API';
|
||||||
|
documentationUrl = 'elasticSearch';
|
||||||
|
properties = [
|
||||||
|
{
|
||||||
|
displayName: 'Username',
|
||||||
|
name: 'username',
|
||||||
|
type: 'string' as NodePropertyTypes,
|
||||||
|
default: '',
|
||||||
|
placeholder: 'hello@n8n.io',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Password',
|
||||||
|
name: 'password',
|
||||||
|
type: 'string' as NodePropertyTypes,
|
||||||
|
typeOptions: {
|
||||||
|
password: true,
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Base URL',
|
||||||
|
name: 'baseUrl',
|
||||||
|
type: 'string' as NodePropertyTypes,
|
||||||
|
default: '',
|
||||||
|
placeholder: 'https://a-b-optimized-deployment-ffc9df.es.us-west1.gcp.cloud.es.io:9243',
|
||||||
|
description: 'Referred to as \'endpoint\' in the ElasticSearch dashboard.',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
275
packages/nodes-base/nodes/ElasticSearch/ElasticSearch.node.ts
Normal file
275
packages/nodes-base/nodes/ElasticSearch/ElasticSearch.node.ts
Normal file
|
@ -0,0 +1,275 @@
|
||||||
|
import {
|
||||||
|
IExecuteFunctions,
|
||||||
|
} from 'n8n-core';
|
||||||
|
|
||||||
|
import {
|
||||||
|
IDataObject,
|
||||||
|
INodeExecutionData,
|
||||||
|
INodeType,
|
||||||
|
INodeTypeDescription,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
import {
|
||||||
|
elasticSearchApiRequest,
|
||||||
|
} from './GenericFunctions';
|
||||||
|
|
||||||
|
import {
|
||||||
|
documentFields,
|
||||||
|
documentOperations,
|
||||||
|
indexFields,
|
||||||
|
indexOperations,
|
||||||
|
} from './descriptions';
|
||||||
|
|
||||||
|
export class ElasticSearch implements INodeType {
|
||||||
|
description: INodeTypeDescription = {
|
||||||
|
displayName: 'ElasticSearch',
|
||||||
|
name: 'elasticSearch',
|
||||||
|
icon: 'file:elasticSearch.svg',
|
||||||
|
group: ['transform'],
|
||||||
|
version: 1,
|
||||||
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||||
|
description: 'Consume the ElasticSearch API',
|
||||||
|
defaults: {
|
||||||
|
name: 'ElasticSearch',
|
||||||
|
color: '#f3d337',
|
||||||
|
},
|
||||||
|
inputs: ['main'],
|
||||||
|
outputs: ['main'],
|
||||||
|
properties: [
|
||||||
|
{
|
||||||
|
displayName: 'Resource',
|
||||||
|
name: 'resource',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Document',
|
||||||
|
value: 'document',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Index',
|
||||||
|
value: 'index',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'document',
|
||||||
|
description: 'Resource to consume',
|
||||||
|
},
|
||||||
|
...documentOperations,
|
||||||
|
...documentFields,
|
||||||
|
...indexOperations,
|
||||||
|
...indexFields,
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
|
const items = this.getInputData();
|
||||||
|
const returnData: IDataObject[] = [];
|
||||||
|
|
||||||
|
const resource = this.getNodeParameter('resource', 0) as string;
|
||||||
|
const operation = this.getNodeParameter('operation', 0) as string;
|
||||||
|
|
||||||
|
let responseData;
|
||||||
|
|
||||||
|
for (let i = 0; i < items.length; i++) {
|
||||||
|
|
||||||
|
if (resource === 'document') {
|
||||||
|
|
||||||
|
// **********************************************************************
|
||||||
|
// document
|
||||||
|
// **********************************************************************
|
||||||
|
|
||||||
|
if (operation === 'get') {
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// document: get
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
const documentId = this.getNodeParameter('documentId', i);
|
||||||
|
|
||||||
|
const qs: IDataObject = {};
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
|
if (Object.keys(additionalFields).length) {
|
||||||
|
Object.assign(qs, additionalFields);
|
||||||
|
}
|
||||||
|
|
||||||
|
const endpoint = `/${indexId}/_doc/${documentId}`;
|
||||||
|
responseData = await elasticSearchApiRequest.call(this, 'GET', endpoint);
|
||||||
|
|
||||||
|
} else if (operation === 'delete') {
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// document: delete
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
const documentId = this.getNodeParameter('documentId', i);
|
||||||
|
|
||||||
|
const qs: IDataObject = {};
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
|
if (Object.keys(additionalFields).length) {
|
||||||
|
Object.assign(qs, additionalFields);
|
||||||
|
}
|
||||||
|
|
||||||
|
const endpoint = `/${indexId}/_doc/${documentId}`;
|
||||||
|
responseData = await elasticSearchApiRequest.call(this, 'DELETE', endpoint);
|
||||||
|
|
||||||
|
} else if (operation === 'getAll') {
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// document: getAll
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
|
const body: IDataObject = {};
|
||||||
|
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
||||||
|
|
||||||
|
if (Object.keys(filters).length) {
|
||||||
|
Object.assign(body, filters);
|
||||||
|
}
|
||||||
|
|
||||||
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
|
||||||
|
const qs: IDataObject = {};
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
|
if (Object.keys(additionalFields).length) {
|
||||||
|
Object.assign(qs, additionalFields);
|
||||||
|
}
|
||||||
|
|
||||||
|
// responseData = await handleListing.call(this, i, 'GET', `/${indexId}/_mget`, body);
|
||||||
|
|
||||||
|
} else if (operation === 'update') {
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// document: update
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
|
const body: IDataObject = {
|
||||||
|
script: this.getNodeParameter('script', i),
|
||||||
|
};
|
||||||
|
|
||||||
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
const documentId = this.getNodeParameter('documentId', i);
|
||||||
|
|
||||||
|
const endpoint = `/${indexId}/_update/${documentId}`;
|
||||||
|
responseData = await elasticSearchApiRequest.call(this, 'POST', endpoint, body);
|
||||||
|
|
||||||
|
} else if (operation === 'index') {
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// document: index
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
|
const body: IDataObject = {
|
||||||
|
field: this.getNodeParameter('field', i),
|
||||||
|
};
|
||||||
|
|
||||||
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
const documentId = this.getNodeParameter('documentId', i);
|
||||||
|
|
||||||
|
const qs: IDataObject = {};
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
|
if (Object.keys(additionalFields).length) {
|
||||||
|
Object.assign(qs, additionalFields);
|
||||||
|
}
|
||||||
|
|
||||||
|
const endpoint = `/${indexId}/_doc/${documentId}`;
|
||||||
|
responseData = await elasticSearchApiRequest.call(this, 'PUT', endpoint, body);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (resource === 'index') {
|
||||||
|
|
||||||
|
// **********************************************************************
|
||||||
|
// index
|
||||||
|
// **********************************************************************
|
||||||
|
|
||||||
|
if (operation === 'get') {
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// index: get
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
|
||||||
|
const qs: IDataObject = {};
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
|
if (Object.keys(additionalFields).length) {
|
||||||
|
Object.assign(qs, additionalFields);
|
||||||
|
}
|
||||||
|
|
||||||
|
responseData = await elasticSearchApiRequest.call(this, 'GET', `/${indexId}`);
|
||||||
|
|
||||||
|
} else if (operation === 'delete') {
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// index: delete
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
|
||||||
|
const qs: IDataObject = {};
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
|
if (Object.keys(additionalFields).length) {
|
||||||
|
Object.assign(qs, additionalFields);
|
||||||
|
}
|
||||||
|
|
||||||
|
responseData = await elasticSearchApiRequest.call(this, 'DELETE', `/${indexId}`);
|
||||||
|
|
||||||
|
} else if (operation === 'create') {
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// index: create
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
|
||||||
|
responseData = await elasticSearchApiRequest.call(this, 'PUT', `/${indexId}`);
|
||||||
|
|
||||||
|
} else if (operation === 'getAll') {
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// index: getAll
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
|
const qs: IDataObject = {
|
||||||
|
allow_no_indices: this.getNodeParameter('allow_no_indices', i),
|
||||||
|
expand_wildcards: this.getNodeParameter('expand_wildcards', i),
|
||||||
|
flat_settings: this.getNodeParameter('flat_settings', i),
|
||||||
|
ignore_unavailable: this.getNodeParameter('ignore_unavailable', i),
|
||||||
|
include_defaults: this.getNodeParameter('include_defaults', i),
|
||||||
|
local: this.getNodeParameter('local', i),
|
||||||
|
master_timeout: this.getNodeParameter('master_timeout', i),
|
||||||
|
};
|
||||||
|
|
||||||
|
// responseData = await handleListing.call(this, i, 'GET', '/_all', {}, qs);
|
||||||
|
|
||||||
|
} else if (operation === 'search') {
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// index: search
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
|
||||||
|
const qs: IDataObject = {};
|
||||||
|
|
||||||
|
responseData = await elasticSearchApiRequest.call(this, 'GET', `/${indexId}/_search`, {}, qs);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Array.isArray(responseData)
|
||||||
|
? returnData.push(...responseData)
|
||||||
|
: returnData.push(responseData);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return [this.helpers.returnJsonArray(returnData)];
|
||||||
|
}
|
||||||
|
}
|
54
packages/nodes-base/nodes/ElasticSearch/GenericFunctions.ts
Normal file
54
packages/nodes-base/nodes/ElasticSearch/GenericFunctions.ts
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
import {
|
||||||
|
OptionsWithUri,
|
||||||
|
} from 'request';
|
||||||
|
|
||||||
|
import {
|
||||||
|
IExecuteFunctions,
|
||||||
|
} from 'n8n-core';
|
||||||
|
|
||||||
|
import {
|
||||||
|
IDataObject,
|
||||||
|
NodeApiError,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
import {
|
||||||
|
ElasticSearchApiCredentials,
|
||||||
|
} from './types';
|
||||||
|
|
||||||
|
export async function elasticSearchApiRequest(
|
||||||
|
this: IExecuteFunctions,
|
||||||
|
method: string,
|
||||||
|
endpoint: string,
|
||||||
|
body: IDataObject = {},
|
||||||
|
qs: IDataObject = {},
|
||||||
|
) {
|
||||||
|
const { username, password, baseUrl } = this.getCredentials('elasticSearchApi') as ElasticSearchApiCredentials;
|
||||||
|
|
||||||
|
const token = Buffer.from(`${username}:${password}`).toString('base64');
|
||||||
|
|
||||||
|
const options: OptionsWithUri = {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Basic ${token}`,
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
method,
|
||||||
|
body,
|
||||||
|
qs,
|
||||||
|
uri: `${baseUrl}${endpoint}`,
|
||||||
|
json: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!Object.keys(body).length) {
|
||||||
|
delete options.body;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Object.keys(qs).length) {
|
||||||
|
delete options.qs;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return await this.helpers.request(options);
|
||||||
|
} catch (error) {
|
||||||
|
throw new NodeApiError(this.getNode(), error);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,328 @@
|
||||||
|
import {
|
||||||
|
INodeProperties,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
export const documentOperations = [
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Delete',
|
||||||
|
value: 'delete',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Get',
|
||||||
|
value: 'get',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Get All',
|
||||||
|
value: 'getAll',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Index',
|
||||||
|
value: 'index',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Update',
|
||||||
|
value: 'update',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'get',
|
||||||
|
description: 'Operation to perform',
|
||||||
|
},
|
||||||
|
] as INodeProperties[];
|
||||||
|
|
||||||
|
export const documentFields = [
|
||||||
|
// ----------------------------------------
|
||||||
|
// document: get
|
||||||
|
// ----------------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Index ID',
|
||||||
|
name: 'indexId',
|
||||||
|
description: 'ID of the document to retrieve.',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'get',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Document ID',
|
||||||
|
name: 'documentId',
|
||||||
|
description: 'ID of the document to retrieve.',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'get',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// document: delete
|
||||||
|
// ----------------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Index ID',
|
||||||
|
name: 'indexId',
|
||||||
|
description: 'ID of the document to delete.',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Document ID',
|
||||||
|
name: 'documentId',
|
||||||
|
description: 'ID of the document to delete.',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// document: getAll
|
||||||
|
// ----------------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Index ID',
|
||||||
|
name: 'indexId',
|
||||||
|
description: '',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Filters',
|
||||||
|
name: 'filters',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Filter',
|
||||||
|
default: {},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Ids',
|
||||||
|
name: 'ids',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'IDs of the documents to retrieve. Allowed when the index is specified in the request URI.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Return All',
|
||||||
|
name: 'returnAll',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'Return all results.',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Limit',
|
||||||
|
name: 'limit',
|
||||||
|
type: 'number',
|
||||||
|
default: 50,
|
||||||
|
description: 'The number of results to return.',
|
||||||
|
typeOptions: {
|
||||||
|
minValue: 1,
|
||||||
|
},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
returnAll: [
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// document: update
|
||||||
|
// ----------------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Index ID',
|
||||||
|
name: 'indexId',
|
||||||
|
description: 'ID of the document to update.',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Document ID',
|
||||||
|
name: 'documentId',
|
||||||
|
description: 'ID of the document to update.',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Script',
|
||||||
|
name: 'script',
|
||||||
|
description: 'Script to update the document. See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-using.html">guide to writing scripts</a>.',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// document: index
|
||||||
|
// ----------------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Index ID',
|
||||||
|
name: 'indexId',
|
||||||
|
description: '',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Document ID',
|
||||||
|
name: 'documentId',
|
||||||
|
description: '',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Field',
|
||||||
|
name: 'field',
|
||||||
|
description: 'JSON source for the document data.',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
] as INodeProperties[];
|
|
@ -0,0 +1,878 @@
|
||||||
|
import {
|
||||||
|
INodeProperties,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
export const indexOperations = [
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Create',
|
||||||
|
value: 'create',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Delete',
|
||||||
|
value: 'delete',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Get',
|
||||||
|
value: 'get',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Get All',
|
||||||
|
value: 'getAll',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Search',
|
||||||
|
value: 'search',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'get',
|
||||||
|
description: 'Operation to perform',
|
||||||
|
},
|
||||||
|
] as INodeProperties[];
|
||||||
|
|
||||||
|
export const indexFields = [
|
||||||
|
// ----------------------------------------
|
||||||
|
// index: get
|
||||||
|
// ----------------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Index ID',
|
||||||
|
name: 'indexId',
|
||||||
|
description: 'ID of the index to retrieve.',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'get',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// index: delete
|
||||||
|
// ----------------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Index ID',
|
||||||
|
name: 'indexId',
|
||||||
|
description: 'ID of the index to delete.',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// index: create
|
||||||
|
// ----------------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Index ID',
|
||||||
|
name: 'indexId',
|
||||||
|
description: 'ID of the index to create.',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// index: getAll
|
||||||
|
// ----------------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Allow No Indices',
|
||||||
|
name: 'allowNoIndices',
|
||||||
|
description: 'If false, the request returns an error if any wildcard expression, index alias, or <code>_all</code> value targets only missing or closed indices. Defaults to true.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Expand Wildcards',
|
||||||
|
name: 'expandWildcards',
|
||||||
|
description: 'Type of index that wildcard expressions can match. Defaults to <code>open</code>.',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'All',
|
||||||
|
value: 'all',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Open',
|
||||||
|
value: 'open',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Closed',
|
||||||
|
value: 'closed',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Hidden',
|
||||||
|
value: 'hidden',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'None',
|
||||||
|
value: 'none',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'all',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Flat Settings',
|
||||||
|
name: 'flatSettings',
|
||||||
|
description: 'If true, return settings in flat format. Defaults to false.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Ignore Unavailable',
|
||||||
|
name: 'ignoreUnavailable',
|
||||||
|
description: ' If false, requests that target a missing index return an error. Defaults to false.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Include Defaults',
|
||||||
|
name: 'includeDefaults',
|
||||||
|
description: 'If true, return all default settings in the response. Defaults to false.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Local',
|
||||||
|
name: 'local',
|
||||||
|
description: ' If true, retrieve information from the local node only. Defaults to false.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Master Timeout',
|
||||||
|
name: 'masterTimeout',
|
||||||
|
description: 'Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to <code>1m</code>. See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units">time units reference</a>.',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Return All',
|
||||||
|
name: 'returnAll',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'Return all results.',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Limit',
|
||||||
|
name: 'limit',
|
||||||
|
type: 'number',
|
||||||
|
default: 50,
|
||||||
|
description: 'The number of results to return.',
|
||||||
|
typeOptions: {
|
||||||
|
minValue: 1,
|
||||||
|
},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
returnAll: [
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// index: search
|
||||||
|
// ----------------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Index ID',
|
||||||
|
name: 'indexId',
|
||||||
|
description: '',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: ' Source',
|
||||||
|
name: 'source',
|
||||||
|
description: 'Whether to include the <code>_source</code> field.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: ' Source Excludes',
|
||||||
|
name: 'sourceExcludes',
|
||||||
|
description: 'Comma-separated list of source fields to exclude from the response. If the <code>_source</code> parameter is false, this parameter is ignored.',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: ' Source Includes',
|
||||||
|
name: 'sourceIncludes',
|
||||||
|
description: 'Comma-separated list of source fields to include in the response. If the <code>_source</code> parameter is false, this parameter is ignored.',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Allow No Indices',
|
||||||
|
name: 'allowNoIndices',
|
||||||
|
description: 'If false, return an error if any wildcard expression, index alias, or <code>_all</code> value targets only missing or closed indices. Defaults to true.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Allow Partial Search Results',
|
||||||
|
name: 'allowPartialSearchResults',
|
||||||
|
description: 'If true, return partial results if there are shard request timeouts or shard failures. If false, returns an error with no partial results. Defaults to true.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Batched Reduce Size',
|
||||||
|
name: 'batchedReduceSize',
|
||||||
|
description: 'Number of shard results that should be reduced at once on the coordinating node. Defaults to 512.',
|
||||||
|
type: 'number',
|
||||||
|
default: 0,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Ccs Minimize Roundtrips',
|
||||||
|
name: 'ccsMinimizeRoundtrips',
|
||||||
|
description: 'If true, network round-trips between the coordinating node and the remote clusters are minimized when executing cross-cluster search requests. Defaults to true.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Docvalue Fields',
|
||||||
|
name: 'docvalueFields',
|
||||||
|
description: 'Comma-separated list of fields to return as the docvalue representation of a field for each hit.',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Expand Wildcards',
|
||||||
|
name: 'expandWildcards',
|
||||||
|
description: 'Type of index that wildcard expressions can match. Defaults to <code>open</code>.',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'All',
|
||||||
|
value: 'all',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Open',
|
||||||
|
value: 'open',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Closed',
|
||||||
|
value: 'closed',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Hidden',
|
||||||
|
value: 'hidden',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'None',
|
||||||
|
value: 'none',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'all',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Explain',
|
||||||
|
name: 'explain',
|
||||||
|
description: 'If true, return detailed information about score computation as part of a hit. Defaults to false.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Ignore Throttled',
|
||||||
|
name: 'ignoreThrottled',
|
||||||
|
description: 'If true, concrete, expanded or aliased indices are ignored when frozen. Defaults to true.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Ignore Unavailable',
|
||||||
|
name: 'ignoreUnavailable',
|
||||||
|
description: 'If true, missing or closed indices are not included in the response. Defaults to false.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Max Concurrent Shard Requests',
|
||||||
|
name: 'maxConcurrentShardRequests',
|
||||||
|
description: 'Define the number of concurrent shard requests per node this search executes concurrently. Defaults to 5.',
|
||||||
|
type: 'number',
|
||||||
|
default: 0,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Pre Filter Shard Size',
|
||||||
|
name: 'preFilterShardSize',
|
||||||
|
description: 'Define a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold.',
|
||||||
|
type: 'number',
|
||||||
|
default: 0,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Query',
|
||||||
|
name: 'q',
|
||||||
|
description: 'Query in the <a href="https://www.elastic.co/guide/en/kibana/current/lucene-query.html">Lucene query string syntax</a>.',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Request Cache',
|
||||||
|
name: 'requestCache',
|
||||||
|
description: 'If true, the caching of search results is enabled for requests where size is 0. See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-request-cache.html">Shard request cache settings</a>. Defaults to index level settings.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Rest Total Hits as Int',
|
||||||
|
name: 'restTotalHitsAsInt',
|
||||||
|
description: 'Whether <code>hits.total</code> should be rendered as an integer or an object in the rest search response. Defaults to false.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Routing',
|
||||||
|
name: 'routing',
|
||||||
|
description: 'Target this primary shard.',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Search Type',
|
||||||
|
name: 'searchType',
|
||||||
|
description: 'How distributed term frequencies are calculated for relevance scoring. Defaults to Query then Fetch.',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Query Then Fetch',
|
||||||
|
value: 'query_then_fetch',
|
||||||
|
description: 'Distributed term frequencies are calculated locally for each shard running the search.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Dfs Query Then Fetch',
|
||||||
|
value: 'dfs_query_then_fetch',
|
||||||
|
description: 'Distributed term frequencies are calculated globally with information gathered from all shards running the search.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'query_then_fetch',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Seq No Primary Term',
|
||||||
|
name: 'seqNoPrimaryTerm',
|
||||||
|
description: 'If true, return the sequence number and primary term of the last modification of each hit. See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/optimistic-concurrency-control.html">Optimistic concurrency control</a>.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Size',
|
||||||
|
name: 'size',
|
||||||
|
description: '',
|
||||||
|
type: 'Define the number of hits to return. Defaults to 10.',
|
||||||
|
default: 10,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Sort',
|
||||||
|
name: 'sort',
|
||||||
|
description: 'Comma-separated list of <code><field>:<direction></code> pairs.',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Stats',
|
||||||
|
name: 'stats',
|
||||||
|
description: 'Tag of the request for logging and statistical purposes.',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Stored Fields',
|
||||||
|
name: 'storedFields',
|
||||||
|
description: 'If true, retrieve the document fields stored in the index rather than the document <code>_source</code>. Defaults to false.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Suggest Field',
|
||||||
|
name: 'suggestField',
|
||||||
|
description: 'Field to use for suggestions.',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Suggest Text',
|
||||||
|
name: 'suggestText',
|
||||||
|
description: 'Source text for which the suggestions should be returned.',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Terminate After',
|
||||||
|
name: 'terminateAfter',
|
||||||
|
description: 'Max number of documents to collect for each shard.',
|
||||||
|
type: 'number',
|
||||||
|
default: 0,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Timeout',
|
||||||
|
name: 'timeout',
|
||||||
|
description: 'Period to wait for active shards. Defaults to <code>1m</code> (one minute). See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units">time units reference</a>.',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Track Scores',
|
||||||
|
name: 'trackScores',
|
||||||
|
description: 'If true, calculate and return document scores, even if the scores are not used for sorting. Defaults to false.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Track Total Hits',
|
||||||
|
name: 'trackTotalHits',
|
||||||
|
description: 'Number of hits matching the query to count accurately. Defaults to 10000.',
|
||||||
|
type: 'number',
|
||||||
|
default: 10000,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Version',
|
||||||
|
name: 'version',
|
||||||
|
description: 'If true, return document version as part of a hit. Defaults to false.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
] as INodeProperties[];
|
|
@ -0,0 +1,2 @@
|
||||||
|
export * from './DocumentDescription';
|
||||||
|
export * from './IndexDescription';
|
14
packages/nodes-base/nodes/ElasticSearch/elasticSearch.svg
Normal file
14
packages/nodes-base/nodes/ElasticSearch/elasticSearch.svg
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="64px" height="64px" viewBox="6 5 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<!-- Generator: Sketch 63.1 (92452) - https://sketch.com -->
|
||||||
|
<title>elastic-search-logo-color-64px</title>
|
||||||
|
<desc>Created with Sketch.</desc>
|
||||||
|
<g id="elastic-search-logo-color-64px" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<rect id="bounding-box" x="0" y="0" width="64" height="64"></rect>
|
||||||
|
<g id="group" transform="translate(8.000000, 4.999500)">
|
||||||
|
<path d="M47.7246,9.708 L47.7276,9.702 C42.7746,3.774 35.3286,0 26.9996,0 C16.4006,0 7.2326,6.112 2.8136,15 L38.0056,15 C40.5306,15 42.9886,14.13 44.9206,12.504 C45.9246,11.659 46.8636,10.739 47.7246,9.708" id="Fill-1" fill="#FEC514"></path>
|
||||||
|
<path d="M0,27.0005 C0,29.4225 0.324,31.7675 0.922,34.0005 L34,34.0005 C37.866,34.0005 41,30.8665 41,27.0005 C41,23.1345 37.866,20.0005 34,20.0005 L0.922,20.0005 C0.324,22.2335 0,24.5785 0,27.0005" id="Fill-4" fill="#343741"></path>
|
||||||
|
<path d="M47.7246,44.293 L47.7276,44.299 C42.7746,50.227 35.3286,54.001 26.9996,54.001 C16.4006,54.001 7.2326,47.889 2.8136,39.001 L38.0056,39.001 C40.5306,39.001 42.9886,39.871 44.9206,41.497 C45.9246,42.342 46.8636,43.262 47.7246,44.293" id="Fill-6" fill="#00BFB3"></path>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
5
packages/nodes-base/nodes/ElasticSearch/types.d.ts
vendored
Normal file
5
packages/nodes-base/nodes/ElasticSearch/types.d.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export type ElasticSearchApiCredentials = {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
baseUrl: string;
|
||||||
|
};
|
|
@ -74,6 +74,7 @@
|
||||||
"dist/credentials/DropboxApi.credentials.js",
|
"dist/credentials/DropboxApi.credentials.js",
|
||||||
"dist/credentials/DropboxOAuth2Api.credentials.js",
|
"dist/credentials/DropboxOAuth2Api.credentials.js",
|
||||||
"dist/credentials/EgoiApi.credentials.js",
|
"dist/credentials/EgoiApi.credentials.js",
|
||||||
|
"dist/credentials/ElasticSearchApi.credentials.js",
|
||||||
"dist/credentials/EmeliaApi.credentials.js",
|
"dist/credentials/EmeliaApi.credentials.js",
|
||||||
"dist/credentials/ERPNextApi.credentials.js",
|
"dist/credentials/ERPNextApi.credentials.js",
|
||||||
"dist/credentials/EventbriteApi.credentials.js",
|
"dist/credentials/EventbriteApi.credentials.js",
|
||||||
|
@ -339,6 +340,7 @@
|
||||||
"dist/nodes/Dropbox/Dropbox.node.js",
|
"dist/nodes/Dropbox/Dropbox.node.js",
|
||||||
"dist/nodes/EditImage.node.js",
|
"dist/nodes/EditImage.node.js",
|
||||||
"dist/nodes/Egoi/Egoi.node.js",
|
"dist/nodes/Egoi/Egoi.node.js",
|
||||||
|
"dist/nodes/ElasticSearch/ElasticSearch.node.js",
|
||||||
"dist/nodes/EmailReadImap.node.js",
|
"dist/nodes/EmailReadImap.node.js",
|
||||||
"dist/nodes/EmailSend.node.js",
|
"dist/nodes/EmailSend.node.js",
|
||||||
"dist/nodes/Emelia/Emelia.node.js",
|
"dist/nodes/Emelia/Emelia.node.js",
|
||||||
|
|
Loading…
Reference in a new issue