Elastic rest high level api RolloverRequest
Elastic rest high level api RolloverRequest
我正在尝试使用 RolloverRequest
自动翻转基于时间的索引。
我的索引格式是 log-000001、log-000002 等,别名是 log
如果我使用的是 REST API,那么我不必提供新的索引名称,因为翻转会自动发生。但是我没有看到使用高级休息获得相同结果的方法 api
RolloverRequest request = new RolloverRequest(aliasName, newIndexname);
尽管documentation说newIndexName
是可选的,但没有只接受一个参数的构造函数,也没有默认构造函数。
我的问题是,有没有办法只将别名传递给 RolloverRequest 以实现自动翻转?如果没有,是否有类似的计划或文档是否具有误导性?
根据下面link
The alias (first argument) that points to the index to rollover, and the name of the new index in case the rollover operation is performed. The new index argument is optional, and can be set to null
所以你可以使用RolloverRequest
如下:
RolloverRequest request = new RolloverRequest("alias", null);
我解决了。缺少的是一个索引模板。翻转不会从索引中复制现有映射——因此它会以这种方式丢失。如果您创建一个与别名匹配的索引模板,那么新索引也将具有与旧滚动索引相同的映射
我正在尝试使用 RolloverRequest
自动翻转基于时间的索引。
我的索引格式是 log-000001、log-000002 等,别名是 log
如果我使用的是 REST API,那么我不必提供新的索引名称,因为翻转会自动发生。但是我没有看到使用高级休息获得相同结果的方法 api
RolloverRequest request = new RolloverRequest(aliasName, newIndexname);
尽管documentation说newIndexName
是可选的,但没有只接受一个参数的构造函数,也没有默认构造函数。
我的问题是,有没有办法只将别名传递给 RolloverRequest 以实现自动翻转?如果没有,是否有类似的计划或文档是否具有误导性?
根据下面link
The alias (first argument) that points to the index to rollover, and the name of the new index in case the rollover operation is performed. The new index argument is optional, and can be set to null
所以你可以使用RolloverRequest
如下:
RolloverRequest request = new RolloverRequest("alias", null);
我解决了。缺少的是一个索引模板。翻转不会从索引中复制现有映射——因此它会以这种方式丢失。如果您创建一个与别名匹配的索引模板,那么新索引也将具有与旧滚动索引相同的映射