Skip to content

Latest commit

 

History

History
29 lines (24 loc) · 897 Bytes

multiget.md

File metadata and controls

29 lines (24 loc) · 897 Bytes

Multi Get

The multiget request allows us to execute multiple get requests in a single request, reducing round trip latency. The format is simple, pass a list of get requests into the client method.

Then to issue multiple get requests we can do something like the following:

val resp = client.execute(
  multiget(
    get id 3 from "coldplay/albums",
    get id 5 from "coldplay/albums",
    get id 7 from "coldplay/albums"
  )
)

This is exactly the same as for the get request, except you must wrap the multiple get requests inside a multiget block. Routing, version and fetched fields options can be specified in the same way as normal get requests:

val resp = client.execute(
  multiget(
    get id 3 from "coldplay/albums" routing "2" fields("name", "year"),
    get id 5 from "coldplay/albums" routing "1",
    get id 7 from "coldplay/albums" version 5
  )
)