Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@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 healthy version release cadence and project activity because the last version was released less than 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.