# @elastic/enterprise-search 中文文档

规范地址：https://npmcn.com/package/%40elastic/enterprise-search/

版本：8\.18\.0
npm 元数据更新时间：2026-09-25T13:38:22.741Z
中文译文更新时间：2026-11-13T10:44:03.044Z
软件包许可：Apache-2\.0

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40elastic/enterprise-search
原文对照：https://npmcn.com/package/%40elastic/enterprise-search/?lang=original
项目主页：https://github.com/elastic/enterprise-search-js/blob/main/packages/enterprise-search
源码仓库：https://github.com/elastic/enterprise-search-js

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：270 kB，46 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=18
- 运行依赖：3 个
- 首次发布：2022-03-21T16:42:49.632Z
- 最新版本发布：2025-04-22T15:57:28.702Z
- 近 30 天下载量：33347（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：5（近 12 个月 0 个）

## 中文简介

Elastic Entertainment Search, App Search, and Worlds Search的官方Node.js客户端.

## 安装

```sh
npm install @elastic/enterprise-search
```

也可以使用：`pnpm add @elastic/enterprise-search`、`yarn add @elastic/enterprise-search`、`bun add @elastic/enterprise-search`

## README

# : 警告: 应用程序搜索和工作场所搜索将在 9. 0 中停止

从"弹性"9.0版本开始,独立"企业搜索"产品将不再纳入我们的提供范围. 它们在8.x版本中仍然以目前的形式得到支持,只接受安全升级和修正. 根据我们的数据,企业搜索客户将在整个8个版本中继续以目前的形式得到支持 [EL 政策](https://www.elastic.co/support/eol)。 。 。 . 我们建议向积极发展的转变 [弹性堆栈](https://www.elastic.co/elastic-stack) 用于搜索的工具。 但是,如果你仍然使用任何企业搜索产品, 我们建议使用最新的稳定发布客户.

以下是一些与更多信息的有用链接:

-   [企业搜索 FAQ](https://www.elastic.co/resources/enterprise-search/enterprise-search-faq)
-   [升级至弹性搜索 9 的一站店](https://www.elastic.co/guide/en/enterprise-search/8.18/upgrading-to-9-x.html)

[![Elastic Enterprise Search](https://github.com/elastic/enterprise-search-js/raw/main/packages/enterprise-search/test/fixtures/elastic-enterprise-search-logo.png)](https://github.com/elastic/enterprise-search-js)

[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) [![Build Status](https://clients-ci.elastic.co/buildStatus/icon?job=elastic%2Benterprise-search-js%2Bmain)](https://clients-ci.elastic.co/job/elastic+enterprise-search-js+main/)。 。 。 . [![Node CI](https://github.com/elastic/enterprise-search-js/actions/workflows/nodejs.yml/badge.svg)](https://github.com/elastic/enterprise-search-js/actions/workflows/nodejs.yml)

Elastic Entertainment Search, App Search, and Worlds Search的官方Node.js客户端.

: 信息 来源:读取 [完整文档](https://www.elastic.co/guide/en/enterprise-search-clients/enterprise-search-node/current/index.html) 对于此客户端 : **弹性.co**。 。 。 .

## 安装

```
npm install @elastic/enterprise-search
```

## 快开始

```js
const { Client } = require('@elastic/enterprise-search')
const client = new Client({
  url: 'http://localhost:3002',
  // basic auth
  auth: {
    username: 'elastic',
    password: 'changeme'
  }
  // bearer auth
  auth: {
    token: 'my-token'
  }
})

// Enterprise Search API
const response = await client.enterprise.getHealth()
console.log(response)

// App Search API
const response = await client.app.search({
  engine_name: 'games',
  body: {
    query: 'Pack-Man'
  }
})
console.log(response)

// Workplace Search API
const response = await client.workplace.getDocument({
  content_source_id: 'test',
  document_id: 'id'
})
console.log(response)
```

## 许可证

该软件根据 [Apache 2 许可证](https://npmcn.com/package/%40elastic/enterprise-search/LICENSE)。 。 。 .

## 常见问题

### @elastic/enterprise-search 是什么？

Elastic Entertainment Search, App Search, and Worlds Search的官方Node\.js客户端\.

### 如何安装 @elastic/enterprise-search？

在项目目录运行 npm install @elastic/enterprise-search，或使用 pnpm add / yarn add / bun add。

### @elastic/enterprise-search 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @elastic/enterprise-search 支持 ESM 还是 CommonJS？

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

### @elastic/enterprise-search 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=18。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @elastic/enterprise-search 可以商用吗？

@elastic/enterprise-search 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @elastic/enterprise-search 的下载量有多少？

根据 npm 官方下载统计，@elastic/enterprise-search 在 2026/10/14 – 2026/11/12 这 30 天内被下载 33,347 次，日均约 1,112 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @elastic/enterprise-search 还在维护吗？

最新版本 8\.18\.0 发布于 2025/04/22（1\.6 年前）；至今共发布 5 个版本，其中过去 12 个月发布了 0 个；首次发布于 2022/03/22。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

