Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno_nest/modules/elasticsearch/deps.ts>Client

Refer to nestjs to realize some common functions for Deno, support hono and oak
Go to Latest
class Client
extends BaseClient
import { Client } from "https://deno.land/x/deno_nest@v3.4.0/modules/elasticsearch/deps.ts";

Properties

indices: Indices

Methods

bulk(params: BulkParams): Promise<BulkInfo>

Performs multiple indexing or delete operations in a single API call. This reduces overhead and can greatly increase indexing speed.

count(params: CountParams, options?: ExOptions): Promise<CountInfo>
create(params: CreateParams, options?: ExOptions): Promise<CreatedInfo>

insert a document

delete(params: DeleteParams): Promise<DeletedInfo>

delete

deleteByIndex(index: string): Promise<DeleteIndexInfo>
deleteByQuery(params: DeleteByQueryParams): Promise<DeleteByQueryInfo>

Deletes documents that match the specified query.

get(params: GetParams): Promise<GetResult>

get by id

getAllIndices(): Promise<string[]>
index(params: IndexParams, options?: ExOptions): Promise<IndexInfo>

insert a document or replace it if it already exists

reindex(params: ReIndexParams): Promise<ReIndexInfo>

The reindex API extracts the document source from the source index and indexes the documents into the destination index. You can copy all documents to the destination index, reindex a subset of the documents or update the source before to reindex it.

search(params: SearchParams): Promise<SearchInfo>

search

update(params: UpdateParams, options?: ExOptions): Promise<UpdatedInfo>

update a document

updateByQuery(params: UpdateByQueryParams, options?: ExOptions): Promise<UpdatedInfo>

update by query if you want to update by query, you must set the query param and script param like this:

const info = await client.updateByQuery({
  index: "myindex",
  query: {
    name: "Richard Hall",
  },
  script: {
    source: 'ctx._source.message = "updated2"',
  },
});

Or you can set the body param yourself like:

{
        query: {
          match: {
            name: "Richard Hall",
          },
        },
        "script": {
          "source": 'ctx._source.message = "updated"',
        },
      },