elasticsearch-store / index-manager / IndexManager
Class: IndexManager
Defined in: index-manager.ts:21
Manage Elasticsearch Indices
Constructors
Constructor
new IndexManager(
client
,enableIndexMutations
):IndexManager
Defined in: index-manager.ts:27
Parameters
Parameter | Type | Default value |
---|---|---|
client | Client | undefined |
enableIndexMutations | boolean | isTest |
Returns
IndexManager
Properties
Property | Modifier | Type | Defined in |
---|---|---|---|
client | readonly | Client | index-manager.ts:22 |
clientMetadata | readonly | ClientMetadata | index-manager.ts:23 |
enableIndexMutations | public | boolean | index-manager.ts:25 |
Methods
exists()
exists(
index
):Promise
<boolean
>
Defined in: index-manager.ts:49
Verify the index exists
Parameters
Parameter | Type |
---|---|
index | string |
Returns
Promise
<boolean
>
formatIndexName()
formatIndexName<
T
>(config
,useWildcard
):string
Defined in: index-manager.ts:60
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
formatTemplateName()
formatTemplateName<
T
>(config
):string
Defined in: index-manager.ts:88
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
getMapping()
getMapping(
index
):Promise
<IndicesGetMappingResponse
>
Defined in: index-manager.ts:293
Parameters
Parameter | Type |
---|---|
index | string |
Returns
Promise
<IndicesGetMappingResponse
>
getTemplate()
getTemplate(
name
,flat_settings
):Promise
<IndicesGetTemplateResponse
>
Defined in: index-manager.ts:384
Parameters
Parameter | Type |
---|---|
name | string |
flat_settings | boolean |
Returns
Promise
<IndicesGetTemplateResponse
>
indexSetup()
indexSetup<
T
>(config
):Promise
<boolean
>
Defined in: index-manager.ts:105
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
isIndexActive()
isIndexActive(
index
):Promise
<boolean
>
Defined in: index-manager.ts:198
Parameters
Parameter | Type |
---|---|
index | string |
Returns
Promise
<boolean
>
migrateIndex()
migrateIndex<
T
>(options
):Promise
<boolean
|ReindexResponse
>
Defined in: index-manager.ts:218
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
putMapping()
putMapping(
index
,type
,properties
):Promise
<IndicesPutMappingResponse
>
Defined in: index-manager.ts:299
Parameters
Parameter | Type |
---|---|
index | string |
type | string |
properties | Record <string , any > |
Returns
Promise
<IndicesPutMappingResponse
>
updateMapping()
updateMapping(
index
,type
,mapping
,logger
):Promise
<void
>
Defined in: index-manager.ts:318
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
>
upsertTemplate()
upsertTemplate(
template
,logger?
):Promise
<void
>
Defined in: index-manager.ts:398
Safely create or update a template
Parameters
Parameter | Type |
---|---|
template | ESMapping |
logger? | Logger |
Returns
Promise
<void
>
waitForIndexAvailability()
protected
waitForIndexAvailability(index
):Promise
<void
>
Defined in: index-manager.ts:429
Parameters
Parameter | Type |
---|---|
index | string |
Returns
Promise
<void
>