0.2.34 • Published 11 months ago

@honestdoor/es-utils v0.2.34

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months 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

11 months ago

0.2.30

1 year ago

0.2.33

1 year ago

0.2.32

1 year ago

0.2.31

1 year ago

0.2.27

2 years ago

0.2.26

2 years ago

0.2.29

2 years ago

0.2.28

2 years ago

0.2.25

2 years ago

0.2.24

2 years ago

0.2.23

2 years ago

0.2.22

2 years ago

0.2.21

2 years ago

0.2.20

2 years ago

0.2.19

2 years ago

0.2.18

2 years ago

0.2.17

2 years ago

0.2.16

2 years ago

0.2.15

2 years ago

0.2.14

2 years ago

0.2.13

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

3 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1-alpha0

2 years ago

0.1.0

3 years ago

0.0.5

3 years ago

0.0.6

3 years ago

0.0.0-alpha-2

3 years ago

0.0.0-alpha-3

3 years ago

0.0.1

3 years ago

0.0.3

3 years ago

0.0.1-alpha-3

3 years ago

0.0.2

3 years ago

0.0.1-alpha-4

3 years ago

0.0.4

3 years ago

0.0.0-2

3 years ago

0.0.0-1

3 years ago

0.0.0

3 years ago