elasticsearch-store / index-manager / IndexManager
Class: IndexManager
Manage Elasticsearch Indices
Constructors
new IndexManager()
new IndexManager(
client
,enableIndexMutations
):IndexManager
Parameters
Parameter | Type | Default value |
---|---|---|
client | Client | undefined |
enableIndexMutations | boolean | isTest |
Returns
Source
elasticsearch-store/src/index-manager.ts:24
Properties
client
readonly
client:Client
Source
elasticsearch-store/src/index-manager.ts:19
clientMetadata
readonly
clientMetadata:ClientMetadata
Source
elasticsearch-store/src/index-manager.ts:20
enableIndexMutations
enableIndexMutations:
boolean
Source
elasticsearch-store/src/index-manager.ts:22
Methods
exists()
exists(
index
):Promise
<boolean
>
Verify the index exists
Parameters
Parameter | Type |
---|---|
index | string |
Returns
Promise
<boolean
>
Source
elasticsearch-store/src/index-manager.ts:46
formatIndexName()
formatIndexName<
T
>(config
,useWildcard
):string
Format the current index name.
Type parameters
Type parameter |
---|
T extends Record <string , any > |
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
config | IndexConfig <T > | undefined | - |
useWildcard | boolean | true | if true a wildcard is added to the end of the end the index name |
Returns
string
Source
elasticsearch-store/src/index-manager.ts:57
formatTemplateName()
formatTemplateName<
T
>(config
):string
Format the template name, similar to formatIndexName except it excludes template wildcards and the time series parts of the index name.
Type parameters
Type parameter |
---|
T extends Record <string , any > |
Parameters
Parameter | Type |
---|---|
config | IndexConfig <T > |
Returns
string
Source
elasticsearch-store/src/index-manager.ts:85
getMapping()
getMapping(
index
):Promise
<IndicesGetMappingResponse
>
Parameters
Parameter | Type |
---|---|
index | string |
Returns
Promise
<IndicesGetMappingResponse
>
Source
elasticsearch-store/src/index-manager.ts:290
getTemplate()
getTemplate(
name
,flat_settings
):Promise
<IndicesGetTemplateResponse
>
Parameters
Parameter | Type |
---|---|
name | string |
flat_settings | boolean |
Returns
Promise
<IndicesGetTemplateResponse
>
Source
elasticsearch-store/src/index-manager.ts:381
indexSetup()
indexSetup<
T
>(config
):Promise
<boolean
>
Safely setup a versioned Index, its template and any other required resources
Type parameters
Type parameter |
---|
T extends Record <string , any > |
Parameters
Parameter | Type |
---|---|
config | IndexConfig <T > |
Returns
Promise
<boolean
>
a boolean that indicates whether the index was created or not
Source
elasticsearch-store/src/index-manager.ts:102
isIndexActive()
isIndexActive(
index
):Promise
<boolean
>
Parameters
Parameter | Type |
---|---|
index | string |
Returns
Promise
<boolean
>
Source
elasticsearch-store/src/index-manager.ts:195
migrateIndex()
migrateIndex<
T
>(options
):Promise
<boolean
|ReindexResponse
>
Perform an Index Migration
IMPORTANT This is a potentially dangerous operation and should only when the cluster is properly shutdown.
Type parameters
Type parameter |
---|
T extends Record <string , any > |
Parameters
Parameter | Type |
---|---|
options | MigrateIndexOptions <T > |
Returns
Promise
<boolean
| ReindexResponse
>
Todo
add support for timeseries and templated indexes
Todo
add support for complicated re-indexing behaviors
Source
elasticsearch-store/src/index-manager.ts:215
putMapping()
putMapping(
index
,type
,properties
):Promise
<IndicesPutMappingResponse
>
Parameters
Parameter | Type |
---|---|
index | string |
type | string |
properties | Record <string , any > |
Returns
Promise
<IndicesPutMappingResponse
>
Source
elasticsearch-store/src/index-manager.ts:296
updateMapping()
updateMapping(
index
,type
,mapping
,logger
):Promise
<void
>
Safely update a mapping
WARNING: This only updates the mapping if it exists
Parameters
Parameter | Type |
---|---|
index | string |
type | string |
mapping | Record <string , any > |
logger | Logger |
Returns
Promise
<void
>
Source
elasticsearch-store/src/index-manager.ts:315
upsertTemplate()
upsertTemplate(
template
,logger
?):Promise
<void
>
Safely create or update a template
Parameters
Parameter | Type |
---|---|
template | ESMapping |
logger ? | Logger |
Returns
Promise
<void
>
Source
elasticsearch-store/src/index-manager.ts:395
waitForIndexAvailability()
protected
waitForIndexAvailability(index
):Promise
<void
>
Parameters
Parameter | Type |
---|---|
index | string |
Returns
Promise
<void
>