Skip to content

Support for runtime index creation #698

@krysseltillada

Description

@krysseltillada

So I've just read the indexing feature design from the wiki https://github.com/redis/redis-om-spring/wiki/Dynamic-Indexing-Feature-Design and checked the latest release from https://github.com/redis/redis-om-spring/releases/tag/v1.1.1 and https://github.com/redis/redis-om-spring/releases/tag/v1.0.6

Please correct me if I'm wrong, but on the wiki, we can specify options for an index by using this annotation:

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface IndexingOptions {
    String indexName() default "";

    // NEW: Support for SpEL expressions
    String dynamicIndexName() default "";

    // NEW: Support for custom naming strategy
    Class<? extends IndexNamingStrategy> namingStrategy() default DefaultNamingStrategy.class;

    // Existing
    IndexCreationMode creationMode() default IndexCreationMode.SKIP_IF_EXIST;

    // NEW: Support for runtime index creation
    boolean allowRuntimeCreation() default false;
}

What I'm interested in is the allowRuntimeCreation. Does that attribute allow us to create an index at runtime rather than at the start of the application context?

By runtime, what I mean by that is the index being created during the initial repository query from Redis?

We have this use case where we need to create indexes on demand per tenant during runtime, but not on every restart of the application.

This would be really great, since we have new tenants being created via an API, and a runtime index creation would help without requiring manual intervention to restart the application.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions