mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08:00
⚡ Implement index operations
This commit is contained in:
parent
50ae196768
commit
96420cf33b
|
@ -11,6 +11,7 @@ import {
|
||||||
|
|
||||||
import {
|
import {
|
||||||
elasticSearchApiRequest,
|
elasticSearchApiRequest,
|
||||||
|
// handleListing,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -35,6 +36,12 @@ export class ElasticSearch implements INodeType {
|
||||||
},
|
},
|
||||||
inputs: ['main'],
|
inputs: ['main'],
|
||||||
outputs: ['main'],
|
outputs: ['main'],
|
||||||
|
credentials: [
|
||||||
|
{
|
||||||
|
name: 'elasticSearchApi',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
displayName: 'Resource',
|
displayName: 'Resource',
|
||||||
|
@ -77,16 +84,20 @@ export class ElasticSearch implements INodeType {
|
||||||
// document
|
// document
|
||||||
// **********************************************************************
|
// **********************************************************************
|
||||||
|
|
||||||
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs.html
|
||||||
|
|
||||||
if (operation === 'get') {
|
if (operation === 'get') {
|
||||||
|
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
// document: get
|
// document: get
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html
|
||||||
|
|
||||||
const indexId = this.getNodeParameter('indexId', i);
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
const documentId = this.getNodeParameter('documentId', i);
|
const documentId = this.getNodeParameter('documentId', i);
|
||||||
|
|
||||||
const qs: IDataObject = {};
|
const qs = {} as IDataObject;
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
if (Object.keys(additionalFields).length) {
|
if (Object.keys(additionalFields).length) {
|
||||||
|
@ -94,7 +105,7 @@ export class ElasticSearch implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
const endpoint = `/${indexId}/_doc/${documentId}`;
|
const endpoint = `/${indexId}/_doc/${documentId}`;
|
||||||
responseData = await elasticSearchApiRequest.call(this, 'GET', endpoint);
|
responseData = await elasticSearchApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||||
|
|
||||||
} else if (operation === 'delete') {
|
} else if (operation === 'delete') {
|
||||||
|
|
||||||
|
@ -102,10 +113,12 @@ export class ElasticSearch implements INodeType {
|
||||||
// document: delete
|
// document: delete
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html
|
||||||
|
|
||||||
const indexId = this.getNodeParameter('indexId', i);
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
const documentId = this.getNodeParameter('documentId', i);
|
const documentId = this.getNodeParameter('documentId', i);
|
||||||
|
|
||||||
const qs: IDataObject = {};
|
const qs = {} as IDataObject;
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
if (Object.keys(additionalFields).length) {
|
if (Object.keys(additionalFields).length) {
|
||||||
|
@ -113,7 +126,7 @@ export class ElasticSearch implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
const endpoint = `/${indexId}/_doc/${documentId}`;
|
const endpoint = `/${indexId}/_doc/${documentId}`;
|
||||||
responseData = await elasticSearchApiRequest.call(this, 'DELETE', endpoint);
|
responseData = await elasticSearchApiRequest.call(this, 'DELETE', endpoint, {}, qs);
|
||||||
|
|
||||||
} else if (operation === 'getAll') {
|
} else if (operation === 'getAll') {
|
||||||
|
|
||||||
|
@ -121,7 +134,9 @@ export class ElasticSearch implements INodeType {
|
||||||
// document: getAll
|
// document: getAll
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
const body: IDataObject = {};
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html
|
||||||
|
|
||||||
|
const body = {} as IDataObject;
|
||||||
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
||||||
|
|
||||||
if (Object.keys(filters).length) {
|
if (Object.keys(filters).length) {
|
||||||
|
@ -130,14 +145,14 @@ export class ElasticSearch implements INodeType {
|
||||||
|
|
||||||
const indexId = this.getNodeParameter('indexId', i);
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
|
||||||
const qs: IDataObject = {};
|
const qs = {} as IDataObject;
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
if (Object.keys(additionalFields).length) {
|
if (Object.keys(additionalFields).length) {
|
||||||
Object.assign(qs, additionalFields);
|
Object.assign(qs, additionalFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// responseData = await handleListing.call(this, i, 'GET', `/${indexId}/_mget`, body);
|
// responseData = await handleListing.call(this, i, 'GET', `/${indexId}/_mget`, body, qs);
|
||||||
|
|
||||||
} else if (operation === 'update') {
|
} else if (operation === 'update') {
|
||||||
|
|
||||||
|
@ -145,9 +160,11 @@ export class ElasticSearch implements INodeType {
|
||||||
// document: update
|
// document: update
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
const body: IDataObject = {
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html
|
||||||
|
|
||||||
|
const body = {
|
||||||
script: this.getNodeParameter('script', i),
|
script: this.getNodeParameter('script', i),
|
||||||
};
|
} as IDataObject;
|
||||||
|
|
||||||
const indexId = this.getNodeParameter('indexId', i);
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
const documentId = this.getNodeParameter('documentId', i);
|
const documentId = this.getNodeParameter('documentId', i);
|
||||||
|
@ -161,14 +178,16 @@ export class ElasticSearch implements INodeType {
|
||||||
// document: index
|
// document: index
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
const body: IDataObject = {
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html
|
||||||
|
|
||||||
|
const body = {
|
||||||
field: this.getNodeParameter('field', i),
|
field: this.getNodeParameter('field', i),
|
||||||
};
|
} as IDataObject;
|
||||||
|
|
||||||
const indexId = this.getNodeParameter('indexId', i);
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
const documentId = this.getNodeParameter('documentId', i);
|
const documentId = this.getNodeParameter('documentId', i);
|
||||||
|
|
||||||
const qs: IDataObject = {};
|
const qs = {} as IDataObject;
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
if (Object.keys(additionalFields).length) {
|
if (Object.keys(additionalFields).length) {
|
||||||
|
@ -176,7 +195,7 @@ export class ElasticSearch implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
const endpoint = `/${indexId}/_doc/${documentId}`;
|
const endpoint = `/${indexId}/_doc/${documentId}`;
|
||||||
responseData = await elasticSearchApiRequest.call(this, 'PUT', endpoint, body);
|
responseData = await elasticSearchApiRequest.call(this, 'PUT', endpoint, body, qs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,22 +205,29 @@ export class ElasticSearch implements INodeType {
|
||||||
// index
|
// index
|
||||||
// **********************************************************************
|
// **********************************************************************
|
||||||
|
|
||||||
if (operation === 'get') {
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices.html
|
||||||
|
|
||||||
|
if (operation === 'create') {
|
||||||
|
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
// index: get
|
// index: create
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html
|
||||||
|
|
||||||
const indexId = this.getNodeParameter('indexId', i);
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
|
||||||
const qs: IDataObject = {};
|
const body = {} as IDataObject;
|
||||||
|
const qs = {} as IDataObject;
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
if (Object.keys(additionalFields).length) {
|
if (Object.keys(additionalFields).length) {
|
||||||
Object.assign(qs, additionalFields);
|
const { aliases, mappings, settings, ...rest } = additionalFields;
|
||||||
|
Object.assign(body, aliases, mappings, settings);
|
||||||
|
Object.assign(qs, rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
responseData = await elasticSearchApiRequest.call(this, 'GET', `/${indexId}`);
|
responseData = await elasticSearchApiRequest.call(this, 'PUT', `/${indexId}`);
|
||||||
|
|
||||||
} else if (operation === 'delete') {
|
} else if (operation === 'delete') {
|
||||||
|
|
||||||
|
@ -209,26 +235,30 @@ export class ElasticSearch implements INodeType {
|
||||||
// index: delete
|
// index: delete
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html
|
||||||
|
|
||||||
const indexId = this.getNodeParameter('indexId', i);
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
|
||||||
const qs: IDataObject = {};
|
responseData = await elasticSearchApiRequest.call(this, 'DELETE', `/${indexId}`);
|
||||||
|
|
||||||
|
} else if (operation === 'get') {
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// index: get
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html
|
||||||
|
|
||||||
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
|
||||||
|
const qs = {} as IDataObject;
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
if (Object.keys(additionalFields).length) {
|
if (Object.keys(additionalFields).length) {
|
||||||
Object.assign(qs, additionalFields);
|
Object.assign(qs, additionalFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
responseData = await elasticSearchApiRequest.call(this, 'DELETE', `/${indexId}`);
|
responseData = await elasticSearchApiRequest.call(this, 'GET', `/${indexId}`, {}, qs);
|
||||||
|
|
||||||
} else if (operation === 'create') {
|
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// index: create
|
|
||||||
// ----------------------------------------
|
|
||||||
|
|
||||||
const indexId = this.getNodeParameter('indexId', i);
|
|
||||||
|
|
||||||
responseData = await elasticSearchApiRequest.call(this, 'PUT', `/${indexId}`);
|
|
||||||
|
|
||||||
} else if (operation === 'getAll') {
|
} else if (operation === 'getAll') {
|
||||||
|
|
||||||
|
@ -236,17 +266,17 @@ export class ElasticSearch implements INodeType {
|
||||||
// index: getAll
|
// index: getAll
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
const qs: IDataObject = {
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
|
||||||
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);
|
responseData = await elasticSearchApiRequest.call(this, 'GET', '/_aliases');
|
||||||
|
responseData = Object.keys(responseData).map(i => ({ indexId: i }));
|
||||||
|
|
||||||
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
|
|
||||||
|
if (!returnAll) {
|
||||||
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
|
responseData = responseData.slice(0, limit);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (operation === 'search') {
|
} else if (operation === 'search') {
|
||||||
|
|
||||||
|
@ -254,9 +284,19 @@ export class ElasticSearch implements INodeType {
|
||||||
// index: search
|
// index: search
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
|
// https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html
|
||||||
|
|
||||||
const indexId = this.getNodeParameter('indexId', i);
|
const indexId = this.getNodeParameter('indexId', i);
|
||||||
|
|
||||||
const qs: IDataObject = {};
|
const body = {} as IDataObject;
|
||||||
|
const qs = {} as IDataObject;
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
|
if (Object.keys(additionalFields).length) {
|
||||||
|
const { query, ...rest } = additionalFields;
|
||||||
|
Object.assign(body, query);
|
||||||
|
Object.assign(qs, rest);
|
||||||
|
}
|
||||||
|
|
||||||
responseData = await elasticSearchApiRequest.call(this, 'GET', `/${indexId}/_search`, {}, qs);
|
responseData = await elasticSearchApiRequest.call(this, 'GET', `/${indexId}/_search`, {}, qs);
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,16 @@ import {
|
||||||
|
|
||||||
export async function elasticSearchApiRequest(
|
export async function elasticSearchApiRequest(
|
||||||
this: IExecuteFunctions,
|
this: IExecuteFunctions,
|
||||||
method: string,
|
method: 'GET' | 'PUT' | 'POST' | 'DELETE',
|
||||||
endpoint: string,
|
endpoint: string,
|
||||||
body: IDataObject = {},
|
body: IDataObject = {},
|
||||||
qs: IDataObject = {},
|
qs: IDataObject = {},
|
||||||
) {
|
) {
|
||||||
const { username, password, baseUrl } = this.getCredentials('elasticSearchApi') as ElasticSearchApiCredentials;
|
const {
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
baseUrl,
|
||||||
|
} = this.getCredentials('elasticSearchApi') as ElasticSearchApiCredentials;
|
||||||
|
|
||||||
const token = Buffer.from(`${username}:${password}`).toString('base64');
|
const token = Buffer.from(`${username}:${password}`).toString('base64');
|
||||||
|
|
||||||
|
|
|
@ -36,52 +36,12 @@ export const documentOperations = [
|
||||||
value: 'update',
|
value: 'update',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'get',
|
default: 'delete',
|
||||||
description: 'Operation to perform',
|
description: 'Operation to perform',
|
||||||
},
|
},
|
||||||
] as INodeProperties[];
|
] as INodeProperties[];
|
||||||
|
|
||||||
export const documentFields = [
|
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
|
// document: delete
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
@ -122,6 +82,46 @@ 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: getAll
|
// document: getAll
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
@ -210,64 +210,6 @@ export const documentFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// 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
|
// document: index
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
@ -325,4 +267,62 @@ export const documentFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
// 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" target="_blank"> ElasticSearch guide to writing scripts</a>.',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
] as INodeProperties[];
|
] as INodeProperties[];
|
||||||
|
|
|
@ -2,6 +2,8 @@ import {
|
||||||
INodeProperties,
|
INodeProperties,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
import * as placeholders from './placeholders';
|
||||||
|
|
||||||
export const indexOperations = [
|
export const indexOperations = [
|
||||||
{
|
{
|
||||||
displayName: 'Operation',
|
displayName: 'Operation',
|
||||||
|
@ -36,19 +38,19 @@ export const indexOperations = [
|
||||||
value: 'search',
|
value: 'search',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'get',
|
default: 'create',
|
||||||
description: 'Operation to perform',
|
description: 'Operation to perform',
|
||||||
},
|
},
|
||||||
] as INodeProperties[];
|
] as INodeProperties[];
|
||||||
|
|
||||||
export const indexFields = [
|
export const indexFields = [
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
// index: get
|
// index: create
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
{
|
{
|
||||||
displayName: 'Index ID',
|
displayName: 'Index ID',
|
||||||
name: 'indexId',
|
name: 'indexId',
|
||||||
description: 'ID of the index to retrieve.',
|
description: 'ID of the index to create.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
required: true,
|
required: true,
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -58,11 +60,91 @@ export const indexFields = [
|
||||||
'index',
|
'index',
|
||||||
],
|
],
|
||||||
operation: [
|
operation: [
|
||||||
'get',
|
'create',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Additional Fields',
|
||||||
|
name: 'additionalFields',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
default: {},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'index',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Aliases',
|
||||||
|
name: 'aliases',
|
||||||
|
description: 'Index aliases which include the index, as an <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html" target="_blank">alias object</a>.',
|
||||||
|
type: 'json',
|
||||||
|
typeOptions: {
|
||||||
|
alwaysOpenEditWindow: true,
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
placeholder: placeholders.aliases,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Include Type Name',
|
||||||
|
name: 'include_type_name',
|
||||||
|
description: 'If true, a mapping type is expected in the body of mappings. Defaults to false.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Mappings',
|
||||||
|
name: 'mappings',
|
||||||
|
description: 'Mapping for fields in the index, as <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html" target="_blank">mapping object</a>.',
|
||||||
|
type: 'json',
|
||||||
|
typeOptions: {
|
||||||
|
alwaysOpenEditWindow: true,
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
placeholder: placeholders.mappings,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Master Timeout',
|
||||||
|
name: 'master_timeout',
|
||||||
|
description: 'Period to wait for a connection to the master node. If no response is received before the timeout expires,<br>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" target="_blank">ElasticSearch time units reference</a>.',
|
||||||
|
type: 'string',
|
||||||
|
default: '1m',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Settings',
|
||||||
|
name: 'settings',
|
||||||
|
description: 'Configuration options for the index, as an <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings" target="_blank">index settings object</a>.',
|
||||||
|
type: 'json',
|
||||||
|
typeOptions: {
|
||||||
|
alwaysOpenEditWindow: true,
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
placeholder: placeholders.indexSettings,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Timeout',
|
||||||
|
name: 'timeout',
|
||||||
|
description: 'Period to wait for a response. If no response is received before the timeout expires, the request<br>fails and returns an error. Defaults to <code>30s</code>. See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units" target="_blank">ElasticSearch time units reference</a>.',
|
||||||
|
type: 'string',
|
||||||
|
default: '30s',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Wait for Active Shards',
|
||||||
|
name: 'wait_for_active_shards',
|
||||||
|
description: 'The number of shard copies that must be active before proceeding with the operation. Set to <code>all</code><br>or any positive integer up to the total number of shards in the index. Default: 1, the primary shard.',
|
||||||
|
type: 'string',
|
||||||
|
default: '1',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
// index: delete
|
// index: delete
|
||||||
|
@ -87,12 +169,12 @@ export const indexFields = [
|
||||||
},
|
},
|
||||||
|
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
// index: create
|
// index: get
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
{
|
{
|
||||||
displayName: 'Index ID',
|
displayName: 'Index ID',
|
||||||
name: 'indexId',
|
name: 'indexId',
|
||||||
description: 'ID of the index to create.',
|
description: 'ID of the index to retrieve.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
required: true,
|
required: true,
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -102,35 +184,38 @@ export const indexFields = [
|
||||||
'index',
|
'index',
|
||||||
],
|
],
|
||||||
operation: [
|
operation: [
|
||||||
'create',
|
'get',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// index: getAll
|
|
||||||
// ----------------------------------------
|
|
||||||
{
|
{
|
||||||
displayName: 'Allow No Indices',
|
displayName: 'Additional Fields',
|
||||||
name: 'allowNoIndices',
|
name: 'additionalFields',
|
||||||
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: 'collection',
|
||||||
type: 'boolean',
|
placeholder: 'Add Field',
|
||||||
default: true,
|
default: {},
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
resource: [
|
resource: [
|
||||||
'index',
|
'index',
|
||||||
],
|
],
|
||||||
operation: [
|
operation: [
|
||||||
'getAll',
|
'get',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Allow No Indices',
|
||||||
|
name: 'allow_no_indices',
|
||||||
|
description: 'If false, the request returns an error if any wildcard expression, index alias,<br>or <code>_all</code> value targets only missing or closed indices. Defaults to true.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Expand Wildcards',
|
displayName: 'Expand Wildcards',
|
||||||
name: 'expandWildcards',
|
name: 'expand_wildcards',
|
||||||
description: 'Type of index that wildcard expressions can match. Defaults to <code>open</code>.',
|
description: 'Type of index that wildcard expressions can match. Defaults to <code>open</code>.',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
options: [
|
options: [
|
||||||
|
@ -156,67 +241,27 @@ export const indexFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'all',
|
default: 'all',
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'getAll',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Flat Settings',
|
displayName: 'Flat Settings',
|
||||||
name: 'flatSettings',
|
name: 'flat_settings',
|
||||||
description: 'If true, return settings in flat format. Defaults to false.',
|
description: 'If true, return settings in flat format. Defaults to false.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'getAll',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Ignore Unavailable',
|
displayName: 'Ignore Unavailable',
|
||||||
name: 'ignoreUnavailable',
|
name: 'ignore_unavailable',
|
||||||
description: ' If false, requests that target a missing index return an error. Defaults to false.',
|
description: ' If false, requests that target a missing index return an error. Defaults to false.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'getAll',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Include Defaults',
|
displayName: 'Include Defaults',
|
||||||
name: 'includeDefaults',
|
name: 'include_defaults',
|
||||||
description: 'If true, return all default settings in the response. Defaults to false.',
|
description: 'If true, return all default settings in the response. Defaults to false.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'getAll',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Local',
|
displayName: 'Local',
|
||||||
|
@ -224,34 +269,20 @@ export const indexFields = [
|
||||||
description: 'If true, retrieve information from the local node only. Defaults to false.',
|
description: 'If true, retrieve information from the local node only. Defaults to false.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'getAll',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Master Timeout',
|
displayName: 'Master Timeout',
|
||||||
name: 'masterTimeout',
|
name: 'master_timeout',
|
||||||
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>.',
|
description: 'Period to wait for a connection to the master node. If no response is received before the timeout expires,<br>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" target="_blank">ElasticSearch time units reference</a>.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '1m',
|
||||||
displayOptions: {
|
},
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'getAll',
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
|
||||||
},
|
// ----------------------------------------
|
||||||
|
// index: getAll
|
||||||
|
// ----------------------------------------
|
||||||
{
|
{
|
||||||
displayName: 'Return All',
|
displayName: 'Return All',
|
||||||
name: 'returnAll',
|
name: 'returnAll',
|
||||||
|
@ -299,7 +330,7 @@ export const indexFields = [
|
||||||
{
|
{
|
||||||
displayName: 'Index ID',
|
displayName: 'Index ID',
|
||||||
name: 'indexId',
|
name: 'indexId',
|
||||||
description: '',
|
description: 'ID of the index to search.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
required: true,
|
required: true,
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -315,11 +346,15 @@ export const indexFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: ' Source',
|
displayName: 'Query',
|
||||||
name: 'source',
|
name: 'query',
|
||||||
description: 'Whether to include the <code>_source</code> field.',
|
description: 'Query in the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html" target="_blank">ElasticSearch Query DSL</a>.',
|
||||||
type: 'boolean',
|
type: 'string',
|
||||||
default: false,
|
typeOptions: {
|
||||||
|
alwaysOpenEditWindow: true,
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
placeholder: placeholders.query,
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
resource: [
|
resource: [
|
||||||
|
@ -332,11 +367,11 @@ export const indexFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: ' Source Excludes',
|
displayName: 'Additional Fields',
|
||||||
name: 'sourceExcludes',
|
name: 'additionalFields',
|
||||||
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: 'collection',
|
||||||
type: 'string',
|
placeholder: 'Add Field',
|
||||||
default: '',
|
default: {},
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
resource: [
|
resource: [
|
||||||
|
@ -347,112 +382,48 @@ export const indexFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
options: [
|
||||||
{
|
|
||||||
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',
|
displayName: 'Allow No Indices',
|
||||||
name: 'allowNoIndices',
|
name: 'allow_no_indices',
|
||||||
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.',
|
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',
|
type: 'boolean',
|
||||||
default: true,
|
default: true,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Allow Partial Search Results',
|
displayName: 'Allow Partial Search Results',
|
||||||
name: 'allowPartialSearchResults',
|
name: 'allow_partial_search_results',
|
||||||
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.',
|
description: 'If true, return partial results if there are shard request timeouts or shard failures.<br>If false, returns an error with no partial results. Defaults to true.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: true,
|
default: true,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Batched Reduce Size',
|
displayName: 'Batched Reduce Size',
|
||||||
name: 'batchedReduceSize',
|
name: 'batched_reduce_size',
|
||||||
description: 'Number of shard results that should be reduced at once on the coordinating node. Defaults to 512.',
|
description: 'Number of shard results that should be reduced at once on the coordinating node. Defaults to 512.',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
typeOptions: {
|
||||||
displayOptions: {
|
minValue: 2,
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
default: 512,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Ccs Minimize Roundtrips',
|
displayName: 'CCS Minimize Roundtrips',
|
||||||
name: 'ccsMinimizeRoundtrips',
|
name: 'ccs_minimize_roundtrips',
|
||||||
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.',
|
description: 'If true, network round-trips between the coordinating node and the remote clusters are minimized when executing cross-cluster search (CCS) requests. Defaults to true.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: true,
|
default: true,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Docvalue Fields',
|
displayName: 'Docvalue Fields',
|
||||||
name: 'docvalueFields',
|
name: 'docvalue_fields',
|
||||||
description: 'Comma-separated list of fields to return as the docvalue representation of a field for each hit.',
|
description: 'Comma-separated list of fields to return as the docvalue representation of a field for each hit.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Expand Wildcards',
|
displayName: 'Expand Wildcards',
|
||||||
name: 'expandWildcards',
|
name: 'expand_wildcards',
|
||||||
description: 'Type of index that wildcard expressions can match. Defaults to <code>open</code>.',
|
description: 'Type of index that wildcard expressions can match. Defaults to <code>open</code>.',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
options: [
|
options: [
|
||||||
|
@ -460,10 +431,6 @@ export const indexFields = [
|
||||||
name: 'All',
|
name: 'All',
|
||||||
value: 'all',
|
value: 'all',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'Open',
|
|
||||||
value: 'open',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'Closed',
|
name: 'Closed',
|
||||||
value: 'closed',
|
value: 'closed',
|
||||||
|
@ -476,18 +443,12 @@ export const indexFields = [
|
||||||
name: 'None',
|
name: 'None',
|
||||||
value: 'none',
|
value: 'none',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Open',
|
||||||
|
value: 'open',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
default: 'all',
|
default: 'all',
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Explain',
|
displayName: 'Explain',
|
||||||
|
@ -495,135 +456,51 @@ export const indexFields = [
|
||||||
description: 'If true, return detailed information about score computation as part of a hit. Defaults to false.',
|
description: 'If true, return detailed information about score computation as part of a hit. Defaults to false.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Ignore Throttled',
|
displayName: 'Ignore Throttled',
|
||||||
name: 'ignoreThrottled',
|
name: 'ignore_throttled',
|
||||||
description: 'If true, concrete, expanded or aliased indices are ignored when frozen. Defaults to true.',
|
description: 'If true, concrete, expanded or aliased indices are ignored when frozen. Defaults to true.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: true,
|
default: true,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Ignore Unavailable',
|
displayName: 'Ignore Unavailable',
|
||||||
name: 'ignoreUnavailable',
|
name: 'ignore_unavailable',
|
||||||
description: 'If true, missing or closed indices are not included in the response. Defaults to false.',
|
description: 'If true, missing or closed indices are not included in the response. Defaults to false.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Max Concurrent Shard Requests',
|
displayName: 'Max Concurrent Shard Requests',
|
||||||
name: 'maxConcurrentShardRequests',
|
name: 'max_concurrent_shard_requests',
|
||||||
description: 'Define the number of concurrent shard requests per node this search executes concurrently. Defaults to 5.',
|
description: 'Define the number of concurrent shard requests per node this search executes concurrently. Defaults to 5.',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
default: 5,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Pre Filter Shard Size',
|
displayName: 'Pre-Filter Shard Size',
|
||||||
name: 'preFilterShardSize',
|
name: 'pre_filter_shard_size',
|
||||||
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.',
|
description: 'Define a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting<br>if the number of shards the search request expands to exceeds the threshold.',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
typeOptions: {
|
||||||
|
minValue: 1,
|
||||||
|
},
|
||||||
default: 0,
|
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',
|
displayName: 'Request Cache',
|
||||||
name: 'requestCache',
|
name: 'request_cache',
|
||||||
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.',
|
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" target="_blank">ElasticSearch shard request cache settings</a>.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Rest Total Hits as Int',
|
displayName: 'Rest Total Hits as Integer',
|
||||||
name: 'restTotalHitsAsInt',
|
name: 'rest_total_hits_as_int',
|
||||||
description: 'Whether <code>hits.total</code> should be rendered as an integer or an object in the rest search response. Defaults to false.',
|
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',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Routing',
|
displayName: 'Routing',
|
||||||
|
@ -631,96 +508,65 @@ export const indexFields = [
|
||||||
description: 'Target this primary shard.',
|
description: 'Target this primary shard.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Search Type',
|
displayName: 'Search Type',
|
||||||
name: 'searchType',
|
name: 'search_type',
|
||||||
description: 'How distributed term frequencies are calculated for relevance scoring. Defaults to Query then Fetch.',
|
description: 'How distributed term frequencies are calculated for relevance scoring. Defaults to Query then Fetch.',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'Query Then Fetch',
|
name: 'Query Then Fetch',
|
||||||
value: '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',
|
name: 'DFS Query Then Fetch',
|
||||||
value: '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',
|
default: 'query_then_fetch',
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Seq No Primary Term',
|
displayName: 'Sequence Number and Primary Term',
|
||||||
name: 'seqNoPrimaryTerm',
|
name: 'seq_no_primary_term',
|
||||||
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>.',
|
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" target="_blank">Optimistic concurrency control</a>.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Size',
|
displayName: 'Size',
|
||||||
name: 'size',
|
name: 'size',
|
||||||
description: '',
|
description: 'Define the number of hits to return. Defaults to 10.',
|
||||||
type: 'Define the number of hits to return. Defaults to 10.',
|
type: 'number',
|
||||||
default: 10,
|
default: 10,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Sort',
|
displayName: 'Sort',
|
||||||
name: 'sort',
|
name: 'sort',
|
||||||
description: 'Comma-separated list of <code><field>:<direction></code> pairs.',
|
description: 'Comma-separated list of <code>field:direction</code> pairs.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Source',
|
||||||
|
name: '_source',
|
||||||
|
description: 'Whether to include the <code>_source</code> field.',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Source Excludes',
|
||||||
|
name: '_source_excludes',
|
||||||
|
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: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Source Includes',
|
||||||
|
name: '_source_includes',
|
||||||
|
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: '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Stats',
|
displayName: 'Stats',
|
||||||
|
@ -728,135 +574,55 @@ export const indexFields = [
|
||||||
description: 'Tag of the request for logging and statistical purposes.',
|
description: 'Tag of the request for logging and statistical purposes.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Stored Fields',
|
displayName: 'Stored Fields',
|
||||||
name: 'storedFields',
|
name: 'stored_fields',
|
||||||
description: 'If true, retrieve the document fields stored in the index rather than the document <code>_source</code>. Defaults to false.',
|
description: 'If true, retrieve the document fields stored in the index rather than the document <code>_source</code>. Defaults to false.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Suggest Field',
|
displayName: 'Suggest Field',
|
||||||
name: 'suggestField',
|
name: 'suggest_field',
|
||||||
description: 'Field to use for suggestions.',
|
description: 'Field to use for suggestions.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Suggest Text',
|
displayName: 'Suggest Text',
|
||||||
name: 'suggestText',
|
name: 'suggest_text',
|
||||||
description: 'Source text for which the suggestions should be returned.',
|
description: 'Source text for which the suggestions should be returned.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Terminate After',
|
displayName: 'Terminate After',
|
||||||
name: 'terminateAfter',
|
name: 'terminate_after',
|
||||||
description: 'Max number of documents to collect for each shard.',
|
description: 'Max number of documents to collect for each shard.',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
default: 0,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Timeout',
|
displayName: 'Timeout',
|
||||||
name: '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>.',
|
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" target="_blank">ElasticSearch time units reference</a>.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '1m',
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Track Scores',
|
displayName: 'Track Scores',
|
||||||
name: 'trackScores',
|
name: 'track_scores',
|
||||||
description: 'If true, calculate and return document scores, even if the scores are not used for sorting. Defaults to false.',
|
description: 'If true, calculate and return document scores, even if the scores are not used for sorting. Defaults to false.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Track Total Hits',
|
displayName: 'Track Total Hits',
|
||||||
name: 'trackTotalHits',
|
name: 'track_total_hits',
|
||||||
description: 'Number of hits matching the query to count accurately. Defaults to 10000.',
|
description: 'Number of hits matching the query to count accurately. Defaults to 10000.',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 10000,
|
default: 10000,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Version',
|
displayName: 'Version',
|
||||||
|
@ -864,15 +630,7 @@ export const indexFields = [
|
||||||
description: 'If true, return document version as part of a hit. Defaults to false.',
|
description: 'If true, return document version as part of a hit. Defaults to false.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'index',
|
|
||||||
],
|
|
||||||
operation: [
|
|
||||||
'search',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
] as INodeProperties[];
|
] as INodeProperties[];
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
export const indexSettings = `{
|
||||||
|
"settings": {
|
||||||
|
"index": {
|
||||||
|
"number_of_shards": 3,
|
||||||
|
"number_of_replicas": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`;
|
||||||
|
|
||||||
|
export const mappings = `{
|
||||||
|
"mappings": {
|
||||||
|
"properties": {
|
||||||
|
"field1": { "type": "text" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`;
|
||||||
|
|
||||||
|
export const aliases = `{
|
||||||
|
"aliases": {
|
||||||
|
"alias_1": {},
|
||||||
|
"alias_2": {
|
||||||
|
"filter": {
|
||||||
|
"term": { "user.id": "kimchy" }
|
||||||
|
},
|
||||||
|
"routing": "shard-1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`;
|
||||||
|
|
||||||
|
export const query = `{
|
||||||
|
"query": {
|
||||||
|
"term": {
|
||||||
|
"user.id": "john"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`;
|
Loading…
Reference in a new issue