Index name , doc say : Cannot be . or .. but run result

Hi @startjava Welcome to the community

Perhaps take a look at the docs you need a valid index name for PUT / if that is what you are trying to create, an index, but as the error message tries to explain, there are other methods for that syntax that is valid.

Is valid syntax for the following

GET /.
HEAD /.
# GET /. 200 OK
{
  "name": "9697c215c241",
  "cluster_name": "docker-cluster",
  "cluster_uuid": "tbRI3CO6TvSYCmR6RDHMvg",
  "version": {
    "number": "8.11.0-SNAPSHOT",
    "build_flavor": "default",
    "build_type": "docker",
    "build_hash": "117cb3b39e713a7856bdfb604c756a4713e8a6d4",
    "build_date": "2023-10-10T21:22:49.722092651Z",
    "build_snapshot": true,
    "lucene_version": "9.8.0",
    "minimum_wire_compatibility_version": "7.17.0",
    "minimum_index_compatibility_version": "7.0.0"
  },
  "tagline": "You Know, for Search"
}
# HEAD /. 200 OK
200 - OK

I am not going to run DELETE /. :slight_smile:

hi @stephenb .
Thank you very much for your guidance, but I'm still not sure.

The document:
discuss.elastic.co/t/index-name-doc-say-cannot-be-or-but-run-result/344864
say:
Cannot be . or ..

But I use:
PUT /.

. as index name
run it,I didn't see the following exception that I was expecting:
{
"error": {
"root_cause": [
{
"type": "invalid_index_name_exception",
"reason": "Invalid index name [.], must not contain '.'",
"index_uuid": "na",
"index": "."
}
].
"type": "invalid_index_name_exception",
"reason": "Invalid index name [.], must not contain '.'",
"index_uuid": "na",
"index": "."
},
"status": 400
}

run result is bottom:
{
"error": "Incorrect HTTP method for uri [/?pretty=true] and method [PUT], allowed: [GET, HEAD, DELETE]",
"status": 405
}

I am not sure if the index name can be used. Or...

. alone is not a valid in index name, so not it can not be used.

Can you explain what you're trying to accomplish? Are you just testing ?

Why would you want to name an index Simply a period?

These are both valid.

PUT /.myindex

#! index name [.myindex] starts with a dot '.', in the next major version, index names starting with a dot are reserved for hidden indices and system indices
{
  "acknowledged": true,
  "shards_acknowledged": true,
  "index": ".myindex"
}

PUT /myindex 

Ad as the message says from the latest release It turns out, though in 9.X index names starting with . will be reserved for system (not user) indices

I'm just testing to see if the documentation is correct. But it turns out, it's a little mixed.

Although. And.. Always the wrong index name, but it responds to misleading information, can I determine that this is a minor bug?

In other words, the document should be updated to:
starts with a dot '.', in the next major version, index names starting with a dot are reserved for hidden indices and system indices

I am very sorry that I have a problem with document cleanliness. I hope that the es document will be more and more perfect.

No worries... And no documents are perfect, ours get better over time.

Also in the future it would help if you tell us what version you are on.

It is suggested to optimize for this situation in the new version of the document, thank you.

elasticsearch version 8.10.2 。
thanks very much。

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.