@cybernetex/kbn-es-query

中文文档
1.0.2发布于 2019/08/21Apache-2.0CommonJS近 30 天下载 7266

This module is responsible for generating Elasticsearch queries for Kibana. See explanations below for each of the subdirectories.

原始使用文档
文档目录3 节
  1. es_query
  2. filters
  3. kuery

kbn-es-query

This module is responsible for generating Elasticsearch queries for Kibana. See explanations below for each of the subdirectories.

es_query

This folder contains the code that combines Lucene/KQL queries and filters into an Elasticsearch query.

buildEsQuery(indexPattern, queries, filters, config)

Generates the Elasticsearch query DSL from combining the queries and filters provided.

buildQueryFromFilters(filters, indexPattern)

Generates the Elasticsearch query DSL from the given filters.

luceneStringToDsl(query)

Generates the Elasticsearch query DSL from the given Lucene query.

migrateFilter(filter, indexPattern)

Migrates a filter from a previous version of Elasticsearch to the current version.

decorateQuery(query, queryStringOptions)

Decorates an Elasticsearch query_string query with the given options.

filters

This folder contains the code related to Kibana Filter objects, including their definitions, and helper functions to create them. Filters in Kibana always contain a meta property which describes which index the filter corresponds to, as well as additional data about the specific filter.

The object that is created by each of the following functions corresponds to a Filter object in the lib directory (e.g. PhraseFilter, RangeFilter, etc.)

buildExistsFilter(field, indexPattern)

Creates a filter (ExistsFilter) where the given field exists.

buildPhraseFilter(field, value, indexPattern)

Creates an filter (PhraseFilter) where the given field matches the given value.

buildPhrasesFilter(field, params, indexPattern)

Creates a filter (PhrasesFilter) where the given field matches one or more of the given values. params should be an array of values.

buildQueryFilter(query, index)

Creates a filter (CustomFilter) corresponding to a raw Elasticsearch query DSL object.

buildRangeFilter(field, params, indexPattern)

Creates a filter (RangeFilter) where the value for the given field is in the given range. params should contain lt, lte, gt, and/or gte.

kuery

This folder contains the code corresponding to generating Elasticsearch queries using the Kibana query language.

In general, you will only need to worry about the following functions from the ast folder:

fromExpression(expression)

Generates an abstract syntax tree corresponding to the raw Kibana query expression.

toElasticsearchQuery(node, indexPattern)

Takes an abstract syntax tree (generated from the previous method) and generates the Elasticsearch query DSL using the given indexPattern. Note that if no indexPattern is provided, then an Elasticsearch query DSL will still be generated, ignoring things like the index pattern scripted fields, field types, etc.

版本与发布记录

@cybernetex/kbn-es-query 共发布 3 个版本,首次发布于 2019/08/17;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.2latest2019/08/217 年前
1.0.12019/08/177 年前
1.0.02019/08/177 年前

关于 @cybernetex/kbn-es-query 的常见问题

@cybernetex/kbn-es-query 是什么?

This module is responsible for generating Elasticsearch queries for Kibana. See explanations below for each of the subdirectories.

如何安装 @cybernetex/kbn-es-query?

在项目目录运行 npm install @cybernetex/kbn-es-query,或使用 pnpm add / yarn add / bun add。

@cybernetex/kbn-es-query 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/cybernetex__kbn-es-query 是否存在。

@cybernetex/kbn-es-query 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@cybernetex/kbn-es-query 可以商用吗?

@cybernetex/kbn-es-query 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@cybernetex/kbn-es-query 的下载量有多少?

根据 npm 官方下载统计,@cybernetex/kbn-es-query 在 2026/10/11 – 2026/11/09 这 30 天内被下载 7,266 次,日均约 242 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cybernetex/kbn-es-query 还在维护吗?

最新版本 1.0.2 发布于 2019/08/21(7 年前);至今共发布 3 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/08/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。