Not able to search from java

Elasticsearch is bound to 127.0.0.1. If host1 is anything else than 127.0.0.1 it will not work.

If you want to call elasticsearch from another machine, you need to change network.host in elasticsearch.yml.

In such a case, read:

[2017-09-12T14:00:35,999][WARN ][o.e.t.n.Netty4Transport  ] [_-RF39w] exception caught on transport layer [[id: 0x3121287e, L:/127.0.0.1:56846 - R:/127.0.0.1:9300]], closing connection
java.io.IOException: Invalid string; unexpected character: 253 hex: fd

^^^ Was that you attempt to use 9200 port instead of 9300?