0.2.34 • Published 3 years ago

@honestdoor/es-utils v0.2.34

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

honestdoor-es-utils

Helpful utilities for working with elasticsearch + extended Client class with custom functions

Client

The client is an extention of the @elastic/elasticsearch Client. It adds additional functionality and better type safety to queries. As well as requiring _source to be supplied in order to keep queries as effecient as possible.

Configuration

import { Client } from '@honestdoor/es-utils'

const { ES_ENDPOINT, ES_USER, ES_PASS } = process.env

const client = new Client({
    node: ES_ENDPOINT,
    auth: {
        username: ES_USER,
        password: ES_PASS
    }
})

Example Usage

filter

Extended base search function with additional fields to make filtering simpler and type safe.

import client from './client'
import { Property } from '@honestdoor/types'
import { rangeFilter, Filters } from '@honestdoor/es-utils'

const filters: Filters<Property> = {
    cityName: termFilter("Edmonton"),
    bedroomsTotal: rangeFilter({
        gte: 3,
        lte: 5
    })
}

const { hits } = client.property.filter({
    _source: ['id', 'cityName', 'bedroomsTotal'],
    filters
})
0.2.34

3 years ago

0.2.30

3 years ago

0.2.33

3 years ago

0.2.32

3 years ago

0.2.31

3 years ago

0.2.27

4 years ago

0.2.26

4 years ago

0.2.29

4 years ago

0.2.28

4 years ago

0.2.25

4 years ago

0.2.24

4 years ago

0.2.23

4 years ago

0.2.22

4 years ago

0.2.21

4 years ago

0.2.20

4 years ago

0.2.19

4 years ago

0.2.18

4 years ago

0.2.17

4 years ago

0.2.16

4 years ago

0.2.15

4 years ago

0.2.14

4 years ago

0.2.13

4 years ago

0.2.12

4 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1-alpha0

4 years ago

0.1.0

4 years ago

0.0.5

4 years ago

0.0.6

4 years ago

0.0.0-alpha-2

4 years ago

0.0.0-alpha-3

4 years ago

0.0.1

4 years ago

0.0.3

4 years ago

0.0.1-alpha-3

4 years ago

0.0.2

4 years ago

0.0.1-alpha-4

4 years ago

0.0.4

4 years ago

0.0.0-2

4 years ago

0.0.0-1

4 years ago

0.0.0

4 years ago