mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
⚡ Add also "simple" option to Document->GetAll
This commit is contained in:
parent
b531f31512
commit
5be8b6d5c2
|
@ -169,6 +169,17 @@ export class Elasticsearch implements INodeType {
|
||||||
responseData = await elasticsearchApiRequest.call(this, 'GET', `/${indexId}/_search`, body, qs);
|
responseData = await elasticsearchApiRequest.call(this, 'GET', `/${indexId}/_search`, body, qs);
|
||||||
responseData = responseData.hits.hits;
|
responseData = responseData.hits.hits;
|
||||||
|
|
||||||
|
const simple = this.getNodeParameter('simple', 0) as IDataObject;
|
||||||
|
|
||||||
|
if (simple) {
|
||||||
|
responseData = responseData.map((item: IDataObject) => {
|
||||||
|
return {
|
||||||
|
_id: item._id,
|
||||||
|
...(item._source as Object),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
} else if (operation === 'create') {
|
} else if (operation === 'create') {
|
||||||
|
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
|
@ -247,6 +247,23 @@ export const documentFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Simple',
|
||||||
|
name: 'simple',
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
description: 'Whether to return a simplified version of the response instead of the raw data',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'document',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Options',
|
displayName: 'Options',
|
||||||
name: 'options',
|
name: 'options',
|
||||||
|
|
Loading…
Reference in a new issue