Elastic Search Error – Node is started with node.data=false, but has shard data

elasticsearch-error-node

[2019-07-11T09:59:18,013][ERROR][o.e.b.Bootstrap ] [es-master01] Exception
java.lang.IllegalStateException: Node is started with node.data=false, but has shard data: [/home/ec2-user/elasticsearch-7.2.0/data/nodes/0/indices/6XsNftnbSbOnzPK3wOKc
0w/0]. Use ‘elasticsearch-node repurpose’ tool to clean up
at org.elasticsearch.env.NodeEnvironment.ensureNoShardData(NodeEnvironment.java:1065) ~[elasticsearch-7.2.0.jar:7.2.0]
at org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:324) ~[elasticsearch-7.2.0.jar:7.2.0]

Solution