Cannot instantiate the type TransportClient

For fetching data from multiple indices, i am trying to use SearchResponse client. But while creating transportClient i get instantiate error. What wrong i am doing?

Following is my code snippet:

public void setup() throws Exception {
Client client = new TransportClient()
.addTransportAddress(new InetSocketTransportAddress(
"localhost", 9300));}

and SearchResponse code is:

SearchResponse response = client.prepareSearch(index).setTypes(type).setQuery(QueryBuilders.wrapperQuery(query))

One more doubt can we use jest client for multiple indices search?
I am using elasticsearch version 6.2.

Here is the documentation:

But you should move to the Rest client instead:

I am trying to perform multiple indices search and i don't find anything like prespareSearch() in rest high level client. But you can suggest me what i can use in restHighLevelClient. I followed [] link and got to know that prepare search only works with transport client.

Did you read the documentation?

I read about multi-search and i am tried using same in ES 6.2, but when i am sending request like:

MultiSearchResponse response = client.msearch(request, RequestOptions.DEFAULT);

I get error on RequestOptions cannot be resolved to a variable, where is RequestOption class?

I think that multisearch is only available from 6.3.
It's not part of the documentation of 6.2:

But you can use the Rest client 6.3 with elasticsearch 6.2.
Or better upgrade your server to elasticsearch 6.3.

I am very much eager to know, how to use rest client 6.3 with ES 6.2 is there any documentation on that?

You are asking for documentation but I feel like you are reading it.

So here we go again:

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