Skip to main content

elasticsearch-store / utils/elasticsearch

utils/elasticsearch

Type Aliases

FlattenProperties

FlattenProperties: Record<string, [ESFieldType, string]>

This is the return type for getFlattenedNamesAndTypes

Source

elasticsearch-store/src/utils/elasticsearch.ts:240

Variables

__timeSeriesTest

const __timeSeriesTest: object = {}

Type declaration

date?

optional date: Date

Source

elasticsearch-store/src/utils/elasticsearch.ts:27

Functions

filterBulkRetries()

filterBulkRetries<T>(records, result): T[]

Type parameters

Type parameter
T

Parameters

ParameterType
recordsT[]
resultBulkResponse

Returns

T[]

Source

elasticsearch-store/src/utils/elasticsearch.ts:50


fixMappingRequest()

fixMappingRequest(client, _params, isTemplate): any

Parameters

ParameterType
clientClient
_paramsobject
_params.bodyESMapping
_params.index?string
_params.name?string
isTemplateboolean

Returns

any

Source

elasticsearch-store/src/utils/elasticsearch.ts:180


getBulkResponseItem()

getBulkResponseItem(input): BulkResponseItemResult

Get the first key and value from the bulk response:

Here is an example input:

 {
"index": {
"_index": "test",
"_type": "type1",
"_id": "1",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": true,
"status": 201
}
}

Parameters

ParameterType
inputany

Returns

BulkResponseItemResult

Source

elasticsearch-store/src/utils/elasticsearch.ts:112


getClientMetadata()

getClientMetadata(client): ClientMetadata

Parameters

ParameterType
clientClient

Returns

ClientMetadata

Source

elasticsearch-store/src/utils/elasticsearch.ts:131


getESVersion()

getESVersion(client): number

Parameters

ParameterType
clientClient

Returns

number

Source

elasticsearch-store/src/utils/elasticsearch.ts:119


getFlattenedNamesAndTypes()

getFlattenedNamesAndTypes(config): FlattenProperties

This is useful for diffing the property mappings, the keys should be sorted so this can be stringified and diffed.

Parameters

ParameterType
configESTypeMapping

Returns

FlattenProperties

Source

elasticsearch-store/src/utils/elasticsearch.ts:246


getTimeByField()

getTimeByField(field): (input) => number

Parameters

ParameterTypeDefault value
fieldstring''

Returns

Function

Parameters
ParameterType
inputany
Returns

number

Source

elasticsearch-store/src/utils/elasticsearch.ts:13


isElasticsearch6()

isElasticsearch6(client): boolean

Parameters

ParameterType
clientClient

Returns

boolean

Source

elasticsearch-store/src/utils/elasticsearch.ts:146


isElasticsearch8()

isElasticsearch8(client): boolean

Parameters

ParameterType
clientClient

Returns

boolean

Source

elasticsearch-store/src/utils/elasticsearch.ts:153


isOpensearch()

isOpensearch(client): boolean

Parameters

ParameterType
clientClient

Returns

boolean

Source

elasticsearch-store/src/utils/elasticsearch.ts:160


isOpensearch1()

isOpensearch1(client): boolean

Parameters

ParameterType
clientClient

Returns

boolean

Source

elasticsearch-store/src/utils/elasticsearch.ts:165


isOpensearch2()

isOpensearch2(client): boolean

Parameters

ParameterType
clientClient

Returns

boolean

Source

elasticsearch-store/src/utils/elasticsearch.ts:172


shardsPath()

shardsPath(index): (stats) => Shard[]

Parameters

ParameterType
indexstring

Returns

Function

Parameters
ParameterType
statsany
Returns

Shard[]

Source

elasticsearch-store/src/utils/elasticsearch.ts:17


timeSeriesIndex()

timeSeriesIndex(index, timeSeriesFormat): string

Parameters

ParameterTypeDefault value
indexstringundefined
timeSeriesFormatTimeSeriesFormat'monthly'

Returns

string

Source

elasticsearch-store/src/utils/elasticsearch.ts:34


verifyIndexShards()

verifyIndexShards(shards): boolean

Parameters

ParameterType
shardsShard[]

Returns

boolean

Source

elasticsearch-store/src/utils/elasticsearch.ts:21