About the data.path

As I have two elastic nodes and set both of their "data.path" to "/var/elastic/data".

After indexing data, I found a strange state:
the first node:
/var/elastic/data/0/....indices
the second node:
/var/elastic/data/0/...indices
/var/elastic/data/1/...indices

why the second node has directory "1" and "0" while the first only has "0"?

Are these two nodes on the same machine? or did you start multiple Elasticsearch processes on the second machine? The 0 is the directory for the first running Elasticsearch process and 1 is the directory for the second running Elasticsearch process so the fact that you have both suggests that (intentionally or unintentionally) you have two Elasticsearch processes running on that machine.

Thanks for your reply.
I may really run two elastic processes or different versions(maybe) in the past so I have two directories now.