Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@forestadmin/datasource-elasticsearch
Advanced tools
The elastic search data source allows importing collections from an elastic search instance.
The elastic search data source allows importing collections from an elastic search instance.
To make everything work as expected, you need to install the package @forestadmin-experimental/datasource-elasticsearch
.
Note that:
Specifying that a field is an array
const { createAgent } = require('@forestadmin/agent');
const { createElasticsearchDataSource } = require('@forestadmin-experimental/datasource-elasticsearch');
// Create agent and import collections from elastic search
const agent = createAgent(options).addDataSource(
createElasticsearchDataSource('http://localhost:9200', configuration =>
configuration
// Add the kibana_sample_data_flights index example
.addCollectionFromIndex({ name: 'Flights', indexName: 'kibana_sample_data_flights' })
// Add the kibana_sample_data_ecommerce index example
.addCollectionFromIndex({ name: 'eCommerce', indexName: 'kibana_sample_data_ecommerce' })
// Add a custom collection template based
.addCollectionFromTemplate({
name: 'ActivityLogs',
templateName: 'activity-logs-v1-template',
// Allow to properly generate index name for records creation based on custom logic
// activity-logs-v1-read-2023_05
generateIndexName: ({ type, createdAt }) => {
const createdDate = new Date(createdAt).toISOString();
// NOTICE: getMonth() returns the month as a zero-based value
const month = new Date(createdDate).getUTCMonth() + 1;
const dateSuffix = `${new Date(createdDate).getUTCFullYear()}_${
month < 10 ? '0' : ''
}${month}`;
return `activity-logs-v1-${type}-${dateSuffix}`;
},
}),
),
));
In Elasticsearch, there is no dedicated array data type. Any field can contain zero or more values by default, however, all values in the array must be of the same data type. So, you will need to hand-specify that a field is indeed an array.
document
is a keyword type seen as a String in the Forest Admin world but we use it with multiple values so let's make it an array of String
collection.removeField('document').addField('documents', {
columnType: ['String'],
dependencies: ['document'],
getValues: records => records.map(record => record.document),
});
FAQs
The elastic search data source allows importing collections from an elastic search instance.
The npm package @forestadmin/datasource-elasticsearch receives a total of 0 weekly downloads. As such, @forestadmin/datasource-elasticsearch popularity was classified as not popular.
We found that @forestadmin/datasource-elasticsearch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.