ElasticSearch Template CRD¶
Example:
apiVersion: xo.90poe.io/v1alpha1
kind: ElasticSearchTemplate
metadata:
name: example-elasticsearchtemplate
namespace: zm
spec:
name: dev_test_test_tmpl
drop_on_delete: true
index_patterns:
- "zm_spm_draft_position_weather_*"
aliases:
some_test: {}
"{index}-alias-for-{gender}":
filter: |
{
"term" : {
"product" : "Elasticsearch"
}
}
aliases:
- "zm_spm_draft_position_weather"
settings:
number_of_shards: 55
shards:
check_on_startup: "false"
codec: "default"
number_of_replicas: 3
mappings: |
{
"dynamic": false,
"_source": {
"enabled": true
},
"properties": {
"isRead": {
"type": "boolean",
"index": true
},
"createdAt": {
"type": "date",
"index": true
}
}
}
Spec¶
Setting are made to be as close as possible to ES API.
You would need to amend spec
section.
Settings | Type | Required | Notes |
---|---|---|---|
name | string | Yes | Name of ES template |
drop_on_delete | bool | No | Should we drop index if K8S object is deleted, default false |
index_patterns | []string | Yes | Array of wildcard expressions used to match the names of indices during creation. |
aliases | map[string]ESAlias | No | Map, where keys are alias names, and values are ESAlias, see ESAlias |
settings | ESIndexSettings | No | See ESIndexSettings |
mappings | string | Yes | Mappings of ES Index, must be valid JSON |
version | int64 | No | Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch. |
ESAlias¶
Settings | Type | Required | Notes |
---|---|---|---|
indices | []string | No | (Array) Array of index names used to perform the action. If the index parameter is not specified, this parameter is required. |
aliases | []string | No | (String) Comma-separated list or wildcard expression of index alias names to add, remove, or delete. If the alias parameter is not specified, this parameter is required for the add or remove action. |
filter | string | No | (Optional, query object in string form) Filter query used to limit the index alias. If specified, the index alias only applies to documents returned by the filter. Filter query used to limit the index alias. If specified, the index alias only applies to documents returned by the filter. See Filtered aliases for an example. |
is_write_index | bool | No | (Optional, boolean) If true, assigns the index as an alias’s write index. Defaults to false. |
routing | string | No | (Optional, string) Custom routing value used to route operations to a specific shard. |
index_routing | string | No | (Optional, string) Custom routing value used for the alias’s indexing operations. |
search_routing | string | No | (Optional, string) Custom routing value used for the alias’s search operations. |