Class Elastic6Service<T>

class: Elastic6Service

  • basic CRUD service for Elastic Search 6

Type Parameters

Hierarchy

Constructors

Properties

_client: Client
_options: ElasticOption
DECOMPOSED_FIELD: "_decomposed" = '_decomposed'
QWERTY_FIELD: "_qwerty" = '_qwerty'

Accessors

  • get isOldES6(): boolean
  • get isOldES6

    • used when setting doctype
    • used when verifying mismatched error and results of search

    Returns boolean

Methods

  • find the index by name

    Parameters

    • Optional indexName: string

      name of the index

    Returns Promise<{ docsCount: number; docsDeleted: number; health: string; index: string; pri: number; priStoreSize: string; rep: number; status: string; storeSize: string; uuid: string }>

  • list of index

    Returns Promise<{ list: { docsCount: number; docsDeleted: number; health: string; index: string; pri: number; priStoreSize: string; rep: number; status: string; storeSize: string; uuid: string }[] }>

  • parse version according to Semantic Versioning (SemVer) rules.

    Returns

    A ParsedVersion object or null if parsing fails and throwable is false.

    Parameters

    • version: string

      The version string to parse (e.g., "1.2.3", "1.2.3-alpha.1", "1.2.3+build.001").

    • Optional options: { throwable?: boolean }

      Optional configuration for throwable behavior.

      • Optional throwable?: boolean

    Returns ParsedVersion

  • push item for time-series data.

    • 타임시리즈 데이터를 푸시합니다.
    const pushedItem = await service.pushItem({ name: 'example' });
    console.log(pushedItem);

    {
    "_id": "auto-generated-id",
    "_version": 1,
    "name": "example"
    }

    Returns

    최종 저정된 결과 데이터

    Parameters

    • item: T

      item to push

    • Optional type: string

      document type (default: doc-type given at construction time)

    Returns Promise<T>

  • update item (throw if not exist) update table set a=1, b=b+2 where id='a1' 0. no of a1 -> 1,2 (created)

    1. a,b := 10,20 -> 11,22
    2. a,b := 10,null -> 11,2 (upsert)
    3. a,b := null,20 -> 1,22

    Parameters

    • id: string

      item-id

    • item: T

      item to update

    • Optional increments: Incrementable

      item to increase

    • Optional options: { maxRetries?: number }

      (optional) request option of client.

      • Optional maxRetries?: number

    Returns Promise<T>

  • prepare default setting

    • migrated from engine-v2.

    Parameters

    • params: { docType: string; idName: string; replicas?: number; shards?: number; timeSeries?: boolean; version?: string }
      • docType: string
      • idName: string
      • Optional replicas?: number
      • Optional shards?: number
      • Optional timeSeries?: boolean
      • Optional version?: string

    Returns any

Generated using TypeDoc