Uninstall elasticsearch completely on windows 7

Hi, I have installed elasticsearch on my system and when I hit http://localhost:9200 on the browser I can see the output but when I try to run /bin/elasticsearch.bat from command prompt it gives me some error which I am not getting. I want to uninstall elasticsearch completely and want to reinstall it on my system.

Below is the error which I am getting, I tried to understand the error and resolve it but not getting anything.

</[2018-07-05T15:39:11,241][INFO ][o.e.n.Node ] [my_first_node] init
ializing ...
[2018-07-05T15:39:11,427][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [m
y_first_node] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: f
ailed to obtain node locks, tried [[C:\ProgramData\Elastic\Elasticsearch\data\el
asticsearch]] with lock id [0]; maybe these locations are not writable or multip
le nodes were started without increasing [node.max_local_storage_nodes] (was [1]
)?
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140
) ~[elasticsearch-6.3.0.jar:6.3.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:
127) ~[elasticsearch-6.3.0.jar:6.3.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwar
eCommand.java:86) ~[elasticsearch-6.3.0.jar:6.3.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:1
24) ~[elasticsearch-cli-6.3.0.jar:6.3.0]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-c
li-6.3.0.jar:6.3.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
~[elasticsearch-6.3.0.jar:6.3.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86)
~[elasticsearch-6.3.0.jar:6.3.0]
Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [
[C:\ProgramData\Elastic\Elasticsearch\data\elasticsearch]] with lock id [0]; may
be these locations are not writable or multiple nodes were started without incre
asing [node.max_local_storage_nodes] (was [1])?
at org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:243
) ~[elasticsearch-6.3.0.jar:6.3.0]
at org.elasticsearch.node.Node.(Node.java:270) ~[elasticsearch-6.3
.0.jar:6.3.0]
at org.elasticsearch.node.Node.(Node.java:252) ~[elasticsearch-6.3
.0.jar:6.3.0]
at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:213) ~[
elasticsearch-6.3.0.jar:6.3.0]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[ela
sticsearch-6.3.0.jar:6.3.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elas
ticsearch-6.3.0.jar:6.3.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136
) ~[elasticsearch-6.3.0.jar:6.3.0]
... 6 more

Here is what I get when I hit the localhost url:-
{
"name" : "my_first_node",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "Gd_3OnnORrO1l8hsCSQ1Bw",
"version" : {
"number" : "6.3.0",
"build_flavor" : "unknown",
"build_type" : "unknown",
"build_hash" : "424e937",
"build_date" : "2018-06-11T23:38:03.357887Z",
"build_snapshot" : false,
"lucene_version" : "7.3.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}

Kindly help.

Your node is running apparently.

Thanks. But now I want to communicate the saved data with Java API and it is not working so the issue is in Java code or in the elasticsearch?
@dadoonet

Most likely your code but as I don't see it, I can't really tell.
Hard to help without knowing exactly what you are doing. ie, does your code run on the same machine which is running your code? What are elasticsearch logs? How do you create a client? Are you using a TransportClient or a RestClient? What is the error you are getting on the client?

@dadoonet
I am following https://dzone.com/articles/elasticsearch-java-api link and doing same in the same java file.
I am getting compile time error with red line in the following lines:
Node node = nodeBuilder().node();
Client client = node.client();
client.prepareIndex("kodcucom", "article", "1")
.setSource(putJsonDocument("ElasticSearch: Java API",
"ElasticSearch provides the Java API, all operations "
+ "can be executed asynchronously using a client object.",
new Date(),
new String[]{"elasticsearch"},
"Hüseyin Akdoğan")).execute().actionGet();
node.close();
And the error in the first and almost every line is :
Multiple markers at this line
- Syntax error on token "(", { expected after
this token
- Syntax error on token ")", delete this token
- Syntax error on token ".", @ expected after
this token

Also I am using spring tool suite IDE of Eclipse and I have created a Spring starter project for this. I am using elasticsearch version 6.3.0 and trying to do CRUD operation through java api.
I have tried all possible way to resolve it but not getting any clue.
Kindly help me.
Thanks.

This article is from 2013! Outdated for sure.

Have a look at https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/index.html instead.

Thank you for sharing this link. I will go through them and understand the concept properly to complete my learning. :slight_smile:
@dadoonet

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