All Products
Search
Document Center

Tablestore:How do I increase the value of the limit parameter to 1000 when I call the Search operation of the search index feature to query data?

Last Updated:Apr 30, 2026

The maximum value of the limit parameter in the Search operation depends on where data is read from. If all columns you want to return are stored in the search index, limit can reach 1000. If any column must be fetched from the data table, limit is capped at 100.

Solution

Whether limit can reach 1000 depends on one condition: are all columns you want to return stored in the search index?

Data source

Maximum limit

Search index only

1000

Data table (any column not in the index)

100

To set limit to 1000, configure the ColumnsToGet parameter so that all returned columns come from the search index. Two methods are available:

  • Method 1: Set ColumnsToGet.columns to the specific attribute columns that exist in the search index.

  • Method 2: Set ColumnsToGet.ReturnAllColumnsFromIndex to true to return all attribute columns stored in the search index. Requires Tablestore SDK for Java V5.6.1 or later.

If none of your existing search indexes contain all the required columns, add the missing columns to an existing index or include them when creating a new index. See Create a search index and Dynamically modify the schema of a search index.

Examples

The following examples use Tablestore SDK for Java. Both methods set limit to 1000 by ensuring all returned columns come from the search index. The approach is the same in SDKs for other languages.

SearchQuery searchQuery = new SearchQuery();
searchQuery.setQuery(new MatchAllQuery());
searchQuery.setLimit(1000);

SearchRequest searchRequest = new SearchRequest(tableName, indexName, searchQuery);

// Method 1: Return specific attribute columns that exist in the search index.
ColumnsToGet columnsToGet1 = new ColumnsToGet();
columnsToGet1.setReturnAll(false);
// Specify the names of columns stored in the search index.
columnsToGet1.setColumns(Arrays.asList("field_1", "field_2", "field_3"));
searchRequest.setColumnsToGet(columnsToGet1);

// Method 2: Return all attribute columns stored in the search index.
// Requires Tablestore SDK for Java V5.6.1 or later.
ColumnsToGet columnsToGet2 = new ColumnsToGet();
columnsToGet2.setReturnAllFromIndex(true);
searchRequest.setColumnsToGet(columnsToGet2);

SearchResponse response = client.search(searchRequest);