Elasticsearch Store: `Index Manager Index Manager`
index-manager.IndexManager
Manage Elasticsearch Indices
Table of contents
Constructors
Properties
Methods
- exists
- formatIndexName
- formatTemplateName
- getMapping
- getTemplate
- indexSetup
- isIndexActive
- migrateIndex
- putMapping
- updateMapping
- upsertTemplate
- waitForIndexAvailability
Constructors
constructor
• new IndexManager(client
, enableIndexMutations?
): IndexManager
Parameters
Name | Type | Default value |
---|---|---|
client | Client | undefined |
enableIndexMutations | boolean | ts.isTest |
Returns
Defined in
elasticsearch-store/src/index-manager.ts:20
Properties
client
• Readonly
client: Client
Defined in
elasticsearch-store/src/index-manager.ts:15
clientMetadata
• Readonly
clientMetadata: ClientMetadata
Defined in
elasticsearch-store/src/index-manager.ts:16
enableIndexMutations
• enableIndexMutations: boolean
Defined in
elasticsearch-store/src/index-manager.ts:18
Methods
exists
▸ exists(index
): Promise
<boolean
>
Verify the index exists
Parameters
Name | Type |
---|---|
index | string |
Returns
Promise
<boolean
>
Defined in
elasticsearch-store/src/index-manager.ts:42
formatIndexName
▸ formatIndexName<T
>(config
, useWildcard?
): string
Format the current index name.
Type parameters
Name | Type |
---|---|
T | extends Record <string , any > |
Parameters
Name | 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
Defined in
elasticsearch-store/src/index-manager.ts:53
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
Name | Type |
---|---|
T | extends Record <string , any > |
Parameters
Name | Type |
---|---|
config | IndexConfig <T > |
Returns
string
Defined in
elasticsearch-store/src/index-manager.ts:81
getMapping
▸ getMapping(index
): Promise
<IndicesGetMappingResponse
>
Parameters
Name | Type |
---|---|
index | string |
Returns
Promise
<IndicesGetMappingResponse
>
Defined in
elasticsearch-store/src/index-manager.ts:286
getTemplate
▸ getTemplate(name
, flat_settings
): Promise
<IndicesGetTemplateResponse
>
Parameters
Name | Type |
---|---|
name | string |
flat_settings | boolean |
Returns
Promise
<IndicesGetTemplateResponse
>
Defined in
elasticsearch-store/src/index-manager.ts:375
indexSetup
▸ indexSetup<T
>(config
): Promise
<boolean
>
Safely setup a versioned Index, its template and any other required resources
Type parameters
Name | Type |
---|---|
T | extends Record <string , any > |
Parameters
Name | Type |
---|---|
config | IndexConfig <T > |
Returns
Promise
<boolean
>
a boolean that indicates whether the index was created or not
Defined in
elasticsearch-store/src/index-manager.ts:98
isIndexActive
▸ isIndexActive(index
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
index | string |
Returns
Promise
<boolean
>
Defined in
elasticsearch-store/src/index-manager.ts:191
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
Name | Type |
---|---|
T | extends AnyObject |
Parameters
Name | Type |
---|---|
options | MigrateIndexOptions <T > |
Returns
Promise
<boolean
| ReindexResponse
>
Todo
add support for timeseries and templated indexes
Todo
add support for complicated re-indexing behaviors
Defined in
elasticsearch-store/src/index-manager.ts:211
putMapping
▸ putMapping(index
, type
, properties
): Promise
<IndicesPutMappingResponse
>
Parameters
Name | Type |
---|---|
index | string |
type | string |
properties | Record <string , any > |
Returns
Promise
<IndicesPutMappingResponse
>
Defined in
elasticsearch-store/src/index-manager.ts:292
updateMapping
▸ updateMapping(index
, type
, mapping
, logger
): Promise
<void
>
Safely update a mapping
WARNING: This only updates the mapping if it exists
Parameters
Name | Type |
---|---|
index | string |
type | string |
mapping | Record <string , any > |
logger | Logger |
Returns
Promise
<void
>
Defined in
elasticsearch-store/src/index-manager.ts:311
upsertTemplate
▸ upsertTemplate(template
, logger?
): Promise
<void
>
Safely create or update a template
Parameters
Name | Type |
---|---|
template | ESMapping |
logger? | Logger |
Returns
Promise
<void
>
Defined in
elasticsearch-store/src/index-manager.ts:389
waitForIndexAvailability
▸ waitForIndexAvailability(index
): Promise
<void
>
Parameters
Name | Type |
---|---|
index | string |
Returns
Promise
<void
>