4

How can I set x-ms-max-item-count from java sdk?

is there an option to set page size to retrieve documents? currently it is limited to 100, i would like to increase it to 1000? how can i do it through the java SDK?

I am using ReactiveCosmosTemplate and have a bean of CosmosClientBuilder that I configure connection and consistency level.

But I cant find the max-item-count for a query. 100 batches is very small for me, I need to increase it. How can I do that?

I couldnt find it anywhere.

DarthVader
  • 52,984
  • 76
  • 209
  • 300
  • Hi DarthVader could you please share you reason for setting "x-ms-max-item-count"? Also, are you looking to do that in the Base java SDK and/or in reactive spring repository? – RCT Jan 18 '22 at 14:44
  • Done it already. cause it is getting batches of 100 docs for a query. with reactive was able to do it with byPage(token, size). One caveat is that, I had to block first otherwise returns all pages. – DarthVader Jan 18 '22 at 16:12

1 Answers1

2

x-ms-max-item-count cannot be directly set but can only be set using CosmosPagedFluX#byPage API in the java V4 SDK.

In non-reactive spring repository this can be set using the “pageSize” in CosmosPageRequest object. Please review the Pagination section in this blog post

In reactive spring repository there is no way of setting "x-ms-max-item-count.

RCT
  • 1,044
  • 1
  • 5
  • 12