n8n/packages/nodes-base/nodes/ElasticSearch/descriptions/DocumentDescription.ts

329 lines
5.3 KiB
TypeScript
Raw Normal View History

2021-05-14 07:50:58 -07:00
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',
},
],
2021-05-17 06:27:47 -07:00
default: 'delete',
2021-05-14 07:50:58 -07:00
description: 'Operation to perform',
},
] as INodeProperties[];
export const documentFields = [
// ----------------------------------------
2021-05-17 06:27:47 -07:00
// document: delete
2021-05-14 07:50:58 -07:00
// ----------------------------------------
{
displayName: 'Index ID',
name: 'indexId',
2021-05-17 06:27:47 -07:00
description: 'ID of the document to delete.',
2021-05-14 07:50:58 -07:00
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
2021-05-17 06:27:47 -07:00
'delete',
2021-05-14 07:50:58 -07:00
],
},
},
},
{
displayName: 'Document ID',
name: 'documentId',
2021-05-17 06:27:47 -07:00
description: 'ID of the document to delete.',
2021-05-14 07:50:58 -07:00
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
2021-05-17 06:27:47 -07:00
'delete',
2021-05-14 07:50:58 -07:00
],
},
},
},
// ----------------------------------------
2021-05-17 06:27:47 -07:00
// document: get
2021-05-14 07:50:58 -07:00
// ----------------------------------------
{
displayName: 'Index ID',
name: 'indexId',
2021-05-17 06:27:47 -07:00
description: 'ID of the document to retrieve.',
2021-05-14 07:50:58 -07:00
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
2021-05-17 06:27:47 -07:00
'get',
2021-05-14 07:50:58 -07:00
],
},
},
},
{
displayName: 'Document ID',
name: 'documentId',
2021-05-17 06:27:47 -07:00
description: 'ID of the document to retrieve.',
2021-05-14 07:50:58 -07:00
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
2021-05-17 06:27:47 -07:00
'get',
2021-05-14 07:50:58 -07:00
],
},
},
},
// ----------------------------------------
// 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,
],
},
},
},
// ----------------------------------------
2021-05-17 06:27:47 -07:00
// document: index
2021-05-14 07:50:58 -07:00
// ----------------------------------------
{
displayName: 'Index ID',
name: 'indexId',
2021-05-17 06:27:47 -07:00
description: '',
2021-05-14 07:50:58 -07:00
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
2021-05-17 06:27:47 -07:00
'index',
2021-05-14 07:50:58 -07:00
],
},
},
},
{
displayName: 'Document ID',
name: 'documentId',
2021-05-17 06:27:47 -07:00
description: '',
2021-05-14 07:50:58 -07:00
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
2021-05-17 06:27:47 -07:00
'index',
2021-05-14 07:50:58 -07:00
],
},
},
},
{
2021-05-17 06:27:47 -07:00
displayName: 'Field',
name: 'field',
description: 'JSON source for the document data.',
2021-05-14 07:50:58 -07:00
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
2021-05-17 06:27:47 -07:00
'index',
2021-05-14 07:50:58 -07:00
],
},
},
},
// ----------------------------------------
2021-05-17 06:27:47 -07:00
// document: update
2021-05-14 07:50:58 -07:00
// ----------------------------------------
{
displayName: 'Index ID',
name: 'indexId',
2021-05-17 06:27:47 -07:00
description: 'ID of the document to update.',
2021-05-14 07:50:58 -07:00
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
2021-05-17 06:27:47 -07:00
'update',
2021-05-14 07:50:58 -07:00
],
},
},
},
{
displayName: 'Document ID',
name: 'documentId',
2021-05-17 06:27:47 -07:00
description: 'ID of the document to update.',
2021-05-14 07:50:58 -07:00
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
2021-05-17 06:27:47 -07:00
'update',
2021-05-14 07:50:58 -07:00
],
},
},
},
{
2021-05-17 06:27:47 -07:00
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>.',
2021-05-14 07:50:58 -07:00
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
2021-05-17 06:27:47 -07:00
'update',
2021-05-14 07:50:58 -07:00
],
},
},
},
] as INodeProperties[];