I’ve got quite a large dataset in Couchbase and observing slowness in the query when I get the meta().id from one of the CB document and then retrieve the actual document based on meta().id using the below implementation (Java SDK 2.7.6) -
is there any way to parallelize or could you please suggest any improvement
List<Map<String, Object>> response = bucket.async().query(N1qlQuery.simple(query))
.flatMap(result -> result.rows()).map(row -> row.value().toMap())
.map(object -> (String) object.get("id"))
.flatMap(id -> bucket.async().get(id))
.map(d -> d.content().toMap())
.toList()
.toBlocking().single()