diff --git a/tests/indices/migrate_modify_data_stream.yml b/tests/indices/migrate_modify_data_stream.yml new file mode 100644 index 0000000..43c5d65 --- /dev/null +++ b/tests/indices/migrate_modify_data_stream.yml @@ -0,0 +1,45 @@ +--- +setup: + - do: + index: + index: 'my-data-index' + refresh: true + body: + name: 'Test data' + "@timestamp": "2023-12-20" + - do: + index: + index: 'my-data-index2' + refresh: true + body: + name: 'Test data' + "@timestamp": "2023-12-20" + - do: + indices.put_index_template: + name: 'my-data-template' + body: + index_patterns: ['my-data-alias*'] + data_stream: {} + - do: + indices.put_alias: + index: 'my-data-index' + name: 'my-data-alias' +--- +teardown: + - do: + indices.delete_data_stream: + name: 'my-data-alias' +--- +'migrate to data stream and modify': + - do: + indices.migrate_to_data_stream: + name: 'my-data-alias' + - is_true: acknowledged + - do: + indices.modify_data_stream: + body: + actions: + - add_backing_index: + data_stream: 'my-data-alias' + index: 'my-data-index2' + - is_true: acknowledged diff --git a/tests/indices/rollover.yml b/tests/indices/rollover.yml new file mode 100644 index 0000000..726ca21 --- /dev/null +++ b/tests/indices/rollover.yml @@ -0,0 +1,69 @@ +--- +teardown: + - do: + indices.delete: { index: logs-1 } + - do: + indices.delete: { index: logs-000002 } +--- +"Rollover index via API": + # create index with alias + - do: + indices.create: + index: logs-1 + wait_for_active_shards: 1 + body: + aliases: + logs_index: {} + logs_search: {} + # index document + - do: + index: + index: logs-1 + id: "1" + body: { "foo": "hello world" } + # make this doc visible in index stats + refresh: true + - do: + get: + index: logs_search + id: "1" + - match: { _index: logs-1 } + - match: { _id: "1" } + - match: { _source: { foo: "hello world" } } + + # perform alias rollover + - do: + indices.rollover: + alias: "logs_search" + wait_for_active_shards: 1 + body: + conditions: + max_docs: 1 + - match: { old_index: logs-1 } + - match: { new_index: logs-000002 } + - match: { rolled_over: true } + - match: { dry_run: false } + - match: { conditions: { "[max_docs: 1]": true } } + + # ensure new index is created + - do: + indices.exists: + index: logs-000002 + - is_true: '' + + # index into new index + - do: + index: + index: logs-000002 + id: "2" + body: { "foo": "hello world" } + - do: + indices.refresh: {} + + # check alias points to the new index + - do: + search: + rest_total_hits_as_int: true + index: logs_search + - match: { hits.total: 1 } + - match: { hits.hits.0._index: "logs-000002"} diff --git a/tests/ingest/10_basic.yml b/tests/ingest/10_basic.yml index 63f1285..5ecd379 100644 --- a/tests/ingest/10_basic.yml +++ b/tests/ingest/10_basic.yml @@ -24,3 +24,6 @@ - do: ingest.delete_pipeline: { id: 'test_pipeline' } - match: { acknowledged: true } + - do: + ingest.processor_grok + - is_true: patterns diff --git a/tests/rank_eval.yml b/tests/rank_eval.yml new file mode 100644 index 0000000..0eb64a0 --- /dev/null +++ b/tests/rank_eval.yml @@ -0,0 +1,29 @@ +--- +setup: + - do: + index: + index: "my-index-000001" + id: "doc1" + refresh: true + body: { text: 'travelling to Amsterdam' } +--- +teardown: + - do: + indices.delete: { index: "my-index-000001" } +--- +"rank eval": + - do: + rank_eval: + index: "my-index-000001" + body: + requests: + - id: "amsterdam_query" + request: { query: { match: { text: "amsterdam" } } } + ratings: + - { "_index": "my-index-000001", "_id": "doc1", "rating": 0 } + - { "_index": "my-index-000001", "_id": "doc2", "rating": 3 } + - { "_index": "my-index-000001", "_id": "doc3", "rating": 1 } + metric: + precision: + k: 5 + - match: { details.amsterdam_query.hits.0.hit._index: 'my-index-000001' }