0.2.34 • Published 2 years ago

@honestdoor/es-utils v0.2.34

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

2 years ago

0.2.30

2 years ago

0.2.33

2 years ago

0.2.32

2 years ago

0.2.31

2 years ago

0.2.27

3 years ago

0.2.26

3 years ago

0.2.29

3 years ago

0.2.28

3 years ago

0.2.25

3 years ago

0.2.24

3 years ago

0.2.23

3 years ago

0.2.22

3 years ago

0.2.21

3 years ago

0.2.20

3 years ago

0.2.19

3 years ago

0.2.18

3 years ago

0.2.17

3 years ago

0.2.16

3 years ago

0.2.15

3 years ago

0.2.14

3 years ago

0.2.13

3 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