@statengine/se-fixtures
v2.0.3
Published
Loads Kibana fixtures into Elasticsearch.
Downloads
38
Keywords
Readme
StatEngine Kibana Fixtures
Library to initialize Elasticsearch/Kibana with default dashboards, visulaizations, index patterns, and advanced settings
Installation
npm install @statengine/se-fixtures
Overview
Fixture templates are JSONish files, which are modified exports from Kibana.
Example template file:
{
"_type": "config",
"_id": "5.5.3-SNAPSHOT",
"_source": {
"buildNum": 15497,
"dateFormat:tz": "{{ FireDepartment.timezone }}",
"timelion:es.timefield": "description.event_opened",
"state:storeInSessionStorage": true
}
}
At seed time, dateFormat:tz
field will be substituted with the value defined in FireDepartment.timezone
.
Adding a new visualization
- To add a new visualization, export the JSON from Kibana via the
Management->Saved Objects
menu - Copy the exported JSON to the templates folder.
- Replace any index names or other variables with the appropriate template expression.
Library Usage
const Fixtures = require('./lib');
const locals = {
FireDepartment: {
latitude: 55,
longitude: -75,
fd_id: '76000',
name: 'Richmond Fire and Emergency Services',
state: 'VA',
firecares_id: '93345',
latitude: 0,
longitude: 0,
timezone: 'US/Eastern',
es_indicies: {
fire-incident: '',
apparatus-fire-incident: ''
}
},
};
Fixtures.deleteKibanaIndex({}, locals, (err) => {
if (err) console.error('Oh no! Error occurred!!!');
else console.info('Successfully initialized!');
});
Testing
You can test locally running npm run compile && node test