Index has Changed Operation
-
When deploying an index:
- If the new index definition is different from the current index definition on the server,
the current index will be overwritten and data will be re-indexed according to the new index definition. - If the new index definition is the same as the one currently deployed on the server,
it will not be overwritten and re-indexing will not occur upon deploying the index.
- If the new index definition is different from the current index definition on the server,
-
Prior to deploying an index:,
- Use
IndexHasChangedOperation
to check if the new index definition differs from the one
on the server to avoid any unwanted changes to the existing indexed data.
- Use
-
In this page:
Check if index has changed
# Some index definition
index_definition = IndexDefinition(
name="UsersByName", maps={"from user in docs.Users select new { user.Name }"}
)
# Define the has-changed operation, pass the index definition
index_has_changed_op = IndexHasChangedOperation(index_definition)
# Execute the operation by passing it to maintenance.send
index_has_changed = store.maintenance.send(index_has_changed_op)
# Return values:
# False: The definition of the index passed is the SAME as the one deployed on the server
# True: The definition of the index passed is DIFFERENT from the one deployed on the server
# Or - index does not exist
Syntax
class IndexHasChangedOperation(MaintenanceOperation[bool]):
def __init__(self, index: IndexDefinition): ...
Parameters | Type | Description |
---|---|---|
index | IndexDefinition | The index definition to check |
Return Value | Description |
---|---|
True |
When the index does not exist on the server or - When the index definition is different from the one deployed on the server |
False |
When the index definition is the same as the one deployed on the server |