Skip to main content
search
Error Logs

Error log: InvalidIndexNameException – The Illegal Name

By November 21, 2025No Comments

Error log: You will see this error when you try to create a new index with a name that doesn’t follow the rules.

{

  "error" : {

    "root_cause" : [

      {

        "type" : "invalid_index_name_exception",

        "reason" : "Invalid index name [My-Index-Name], must be lowercase",

        "index_uuid" : "_na_",

        "index" : "My-Index-Name"

      }

    ],

    "type" : "invalid_index_name_exception",

    "reason" : "Invalid index name [My-Index-Name], must be lowercase"

  },

  "status" : 400

}

Why… is this happening? OpenSearch has strict naming rules for indices. This error means the name you provided violates one or more of them.

The most common violations are:

  1. Uppercase letters: This is the #1 cause. Index names must be all lowercase.
  2. Invalid characters: You cannot use \, /, *, ?, ", <, >, |, (space), ,, or #.
  3. Invalid start characters: Index names cannot start with _ (underscore), - (hyphen), or + (plus). (Names starting with . are reserved for internal OpenSearch indices).
  4. Other rules: Names cannot be just . or .., and they cannot be longer than 255 bytes.

Best Practice:

  1. Always use lowercase: Make this a firm rule for all your applications and scripts.
  2. Use kebab-case: The recommended naming convention is to use hyphens to separate words (e.g., my-application-logs-2025.11.03). Underscores (_) are also allowed but hyphens are generally preferred.
  3. Standardize your naming: Create a clear, consistent naming pattern for your indices. A good pattern is [team]-[application]-[datatype]-[date], for example:
    web-nginx-access-2025-11-03
    billing-api-errors-prod
  4. Check your client: If you’re not setting the name yourself, check the configuration of your client (Logstash, Filebeat, etc.). The index name is often set in its output configuration, and it might be generating an invalid name.

What else can I do? Having trouble coming up with a good naming convention for your organization? This is a great topic to discuss on the OpenSearch community forums. Reach out to the vibrant OpenSearch community for help and support on the OpenSearch Slack Channel 

Author