elastic-package referenceedit

elastic-package is a command line tool, written in Go, used for developing Elastic packages. It can help you lint, format, test, build, and promote your packages.

Get startededit

  1. Download and build the latest main of elastic-package binary:

    git clone https://github.com/elastic/elastic-package.git
    make build

    Make sure that you’ve correctly set up the $GOPATH and $PATH environment variables. elastic-package must be accessible from your $PATH.

  2. Change into the directory of the package under development:

    cd my-package
  3. Run the help command to see available commands

    elastic-package help

Command referenceedit

The following elastic-package commands are available. For more details on a specific command, run elastic-package help <command>.

Some commands have a global context, meaning that you can execute them from anywhere. Other commands have a package context; these must be executed from somewhere under a package root folder, and the command will only operate on the contents of that package.

elastic-package helpedit

Context: global

Use this command to list all commands available under elastic-package and a brief description of what each command does.

elastic-package buildedit

Context: package

Use this command to build a package. Currently, it supports only the "integration" package type.

Built packages are stored in the "build/" folder located at the root folder of the local Git repository checkout that contains your package folder. The command will also render the README file in your package folder if a corresponding template file present in _dev/build/docs/README.md. All _dev directories under your package will be omitted.

Built packages are served up by the Elastic Package Registry running locally (see "elastic-package stack"). Therefore, if you want a local package to be served up by the local Elastic Package Registry, make sure to build that package first using "elastic-package build".

You can also publish built packages to the global package registry service.

elastic-package checkedit

Context: package

Use this command to verify if the package is correct in terms of formatting, validation and building.

It will execute the format, lint, and build commands all at once, in that order.

elastic-package cleanedit

Context: package

Use this command to clean resources used for building the package.

The command will remove built package files (in build/), files needed for managing the development stack (in ~/.elastic-package/stack/development) and stack service logs (in ~/.elastic-package/tmp/service_logs).

elastic-package createedit

Context: global

Use this command to create a new package or add more data streams.

The command can help bootstrap the first draft of a package using an embedded package template. Then, you can use it to extend the package with more data streams.

For details on creating a new package, review the HOWTO guide.

elastic-package exportedit

Context: package

Use this command to export assets relevant for the package, e.g. Kibana dashboards.

elastic-package formatedit

Context: package

Use this command to format the package files.

The formatter supports JSON and YAML format and skips "ingest_pipeline" directories as it’s hard to correctly format Handlebars template files. As a result, formatted files are overwritten.

elastic-package installedit

Context: package

Use this command to install the package in Kibana.

To install the package in Kibana, the command uses Kibana API. The package must be exposed via the Elastic Package Registry.

elastic-package lintedit

Context: package

Use this command to validate the contents of a package using the package specification (see: https://github.com/elastic/package-spec).

The command ensures that the package aligns with the package spec and that the README file is up-to-date with its template (if present).

elastic-package profilesedit

Context: global

Use this command to add, remove, and manage multiple config profiles.

Individual user profiles appear in ~/.elastic-package/stack and contain all the config files needed by the "stack" subcommand. Once a new profile is created, it can be specified with the -p flag, or the ELASTIC_PACKAGE_PROFILE environment variable. User profiles are not overwritten on an upgrade of elastic-stack and can be freely modified to allow for different stack configs.

elastic-package promoteedit

Context: global

Use this command to move packages between the Elastic Package Registry snapshot, staging, and production stages.

This command is intended primarily for use by administrators.

It allows for selecting packages for promotion and opens new pull requests to review changes. However, please be aware that the tool checks out an in-memory Git repository and switches over branches (snapshot, staging and production), so it may take longer to promote a larger number of packages.

elastic-package publishedit

Context: package

Use this command to publish a new package revision.

The command checks if the package has already been published (whether it’s present in the snapshot/staging/production branch or open as pull request). If the package revision hasn’t been published, it will open a new pull request.

elastic-package serviceedit

Context: package

Use this command to boot up the service stack that can be observed with the package.

The command manages the lifecycle of the service stack defined for the package (_dev/deploy) for package development and testing purposes.

elastic-package stackedit

Context: global

Use this command to spin up a Docker-based Elastic Stack consisting of Elasticsearch, Kibana, and the Elastic Package Registry. By default, the latest released version of the Elastic Stack is spun up, but it is possible to specify a different version, including SNAPSHOT versions.

For details on connecting the service with the Elastic Stack, see the service command.

elastic-package status [package]edit

Context: package

Use this command to display the current deployment status of a package.

If a package name is specified, then information about that package is returned. Otherwise, this command checks if the current directory is a package directory and reports its status.

elastic-package testedit

Context: package

Use this command to run tests on a package. Currently, the following types of tests are available:

Asset Loading Testsedit

These tests ensure that all the Elasticsearch and Kibana assets defined by your package get loaded up as expected.

For details on running asset loading tests for a package, see the HOWTO guide.

Pipeline Testsedit

These tests allow you to exercise any Ingest Node Pipelines defined by your packages.

For details on how configuring a pipeline test for a package, review the HOWTO guide.

Static Testsedit

These tests allow you to verify if all static resources of the package are valid, e.g. if all fields of the sample_event.json are documented.

For details on running static tests for a package, see the HOWTO guide.

System Testsedit

These tests allow you to test a package ability for ingesting data end-to-end.

For details on configuring and running system tests, review the HOWTO guide.

elastic-package uninstalledit

Context: package

Use this command to uninstall the package in Kibana.

To uninstall the package in Kibana, the command uses the Kibana API. The package must be exposed via the Elastic Package Registry.

elastic-package versionedit

Context: global

Use this command to print the version of elastic-package that you have installed. This command is especially useful when reporting bugs.