Turn off automatic index construction


[AWS OpenSearch Managed Service User]

I’m ingesting millions of documents and was advised to create monthly indices.
To setup, I created monthly indices for a year back and a year forward. I’m not using aliases as I may need to write to these any at any time. These indices also have explicit mappings.

The problem is I get corrections that are years out and an index doesn’t exist, so opensearch automatically creates a new one. I’m using the bulk API, but opensearch doesn’t raise any errors if the index doesn’t exist. I can check for index existence, but that’s a costly operation for my volume.

Any suggestions? Am I making this too hard? I’d like to turn off automatic index construction if possible, or set an explicit default mapping for an index that doesn’t exist.

Why not write to indexname-YEAR-MONTH. If your templates are in the cluster they will be applied to new indices as well.

I’m already writing to indexname-YEAR-MONTH. What templates are you referring to?

Just the normal index templates, but I reread your first post. I think I’m not totally clear what your problem is, why not just write to the index for the right month wether it exists or not?

I wasn’t aware index templating existed, and that solves my problem because these new indices need to follow an explicit mapping.

1 Like