Multisearch API in Elasticsearch v5 / v6 using Java Client


(Nathan Trevivian) #1

I'm currently upgrading our elasticsearch from v2.3.4 to v5.6 and then v6.x.

I'm starting to use the RestHighLevelClient and want to execute a MultiSearchRequest. How can I do this RestHighLevelClient in v5? It looks like the documentation only covers v7 (https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-multi-search.html)?

Is this something I have to do via the low level api in these versions?

Thanks for any help offered.


(Nathan Trevivian) #2

I don't understand. There's a MultiSearchRequest and a MultiSearchResponse but no way of executing a request to get a response via the RestHighLevelClient?

So do I need to use the low level client, or revert to using the TransportClient?


(David Pilato) #3

You should better move directly to 6.x IMO.
But for now, you can indeed call the Low Level client.


(Nathan Trevivian) #4

Ok, thanks! We are moving to 6.x, but 6.x won't read indices created in 2.x. So I need to move to the latest version of 5.x, reindex the data, then snapshot and restore onto 6.x..., and there are some other things I need to do that involve no-downtime for users etc. It's complicated, but basically, users may have to query from the 5.x cluster at some point, hence using the 5.x client.

I am tempted to do something else though to prevent that and move them straight to 6...


(David Pilato) #5

How are you going to move from 2.x to 5.x without any downtime?

I don't know what are the implications for you but my recommendation is to move to 6.5.1 directly if possible.
If possible, I'd:

  • create a brand new 6.5 cluster
  • use the reindex API to read from 2.x and index into 6.x
  • Switch the application to 6.x (using 6.x HLClient)
  • Delete the 2.x cluster

My 0.05 cents.


(Nathan Trevivian) #6

Do you mean do reindexing over the wire? Wouldn't it be faster to reindex on disk?
I'm assuming this is what you mean because the documentation specifically states that you cannot restore a v2 snapshot to a v6 cluster...?


(David Pilato) #7

Restore in the documentation means Snapshot and Restore feature. Which indeed can not work from 2.x indices in a 6.x cluster.

I'm speaking about reindex API. See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#reindex-from-remote


(Nathan Trevivian) #8

Sure, but given that it's going to take > 3 weeks on a 9-node cluster to reindex the data when its co-located on disk, then I feel that doing it across the wire is a bad idea...? Am I wrong?

Especially when users are currently hitting the v2 cluster with gusto.


(David Pilato) #9

I don't know. You have to test it.