Since opensearch has no equivalent api of this https://www.elastic.co/guide/en/elasticsearch/reference/7.17/indices-migrate-to-data-stream.html POST /_data_stream/_migrate/<alias>
(reason here - Support migrating indexes to data streams. · Issue #2017 · opensearch-project/OpenSearch · GitHub ) what’s the way to migrate indices to data-streams?
I think you can use reindex API to migrate ordinary indices to data stream.
hi,
yes that is clear but i’m trying to nail down the full process, it’s not just “reindex from source to destination”
so far i have come up with this
PUT syslog-*/_settings
{
"index": {
"number_of_replicas": 0
}
}
POST _reindex
{
"source":{
"index":"syslog-2023.04.04"
},
"dest":{
"index":"tmp-syslog-2023.04.04"
}
}
PUT tmp-syslog-2023.04.04/_settings
{
"index": {
"number_of_replicas": 0
}
}
DELETE /syslog-2023.04.04
POST _reindex
{
"source":{
"index":"tmp-syslog-2023.04.04"
},
"dest":{
"index":"syslog-2023.04.04",
"op_type":"create"
}
}
DELETE /tmp-syslog-2023.04.02
You can create a data stream firstly, then specify multiple indices or wildcard patterns for the source.index
parameter, and specify the data stream name for the dest.index
parameter, while op_type
must be create
, like this:
POST _reindex
{
"source":{
"index": "test*"
},
"dest": {
"index":"logs-haproxy",
"op_type": "create"
}
}