Skip to main content

AliasManager

Struct AliasManager 

Source
pub struct AliasManager { /* private fields */ }
Expand description

别名管理器

维护别名到索引的映射,支持过滤别名和路由别名

Implementations§

Source§

impl AliasManager

Source

pub fn new() -> Self

Source

pub fn update_aliases(&self, actions: Vec<AliasAction>) -> Result<(), EsError>

执行别名操作(批量添加/移除)

Source

pub fn add_alias(&self, def: AliasDefinition) -> Result<(), EsError>

添加单个别名

Source

pub fn remove_alias(&self, name: &str, index: &str) -> Result<(), EsError>

移除单个别名

Source

pub fn resolve_index(&self, alias: &str) -> Result<Vec<String>, EsError>

获取别名指向的索引

Source

pub fn get_aliases(&self, index: &str) -> Result<Vec<AliasDefinition>, EsError>

获取索引的所有别名

Source

pub fn list_aliases(&self) -> Result<Vec<AliasDefinition>, EsError>

获取所有别名

Source

pub fn swap_alias( &self, alias: &str, old_index: &str, new_index: &str, ) -> Result<(), EsError>

切换别名指向(原子操作:添加新指向 + 移除旧指向)

常用于零停机重新索引场景

Source

pub fn get_write_index(&self, alias: &str) -> Result<Option<String>, EsError>

获取写入索引(标记为 is_write_index 的索引)

Trait Implementations§

Source§

impl Default for AliasManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.