--- title: "Query Index in NoSQL" url: https://docs.catalyst.zoho.com/en/sdk/javascript/v1/cloudscale/nosql/query-index/ description: "This page describes the method to perform operations in the NoSQL component." last_updated: 2026-09-09T10:45:38Z service: CloudScale type: general related_links: - name: "Catalyst CloudScale" url: /en/cloud-scale/ - name: "NoSQL Help Documentation" url: /en/cloud-scale/help/nosql/introduction/ - name: "Java SDK Documentation" url: /en/sdk/java/v1/cloud-scale/nosql/query-index/ - name: "Python SDK Documentation" url: /en/sdk/python/v1/cloud-scale/nosql/query-index/ - name: "REST API Documentation" url: /en/api/code-reference/cloud-scale/nosql/query-index/#QueryIndex repository: name: "Repository" url: https://github.com/catalystbyzoho/zcatalyst-sdk-js --- # Query Index in NoSQL > **Note:** Ensure you have installed the [required package](https://docs.catalyst.zoho.com/en/sdk/javascript/v1/cloudscale/nosql/overview/#prerequisites) to use this SDK method. You can query a NoSQL index and retrieve data by identifying the items using the [primary keys](https://docs.catalyst.zoho.com/en/cloud-scale/help/nosql/components/#table-keys) of the index. Indexing allows you to execute alternate queries on the table data without making use of the primary keys of the main table. You can configure indexes from the [Catalyst console](https://docs.catalyst.zoho.com/en/cloud-scale/help/nosql/indexing/create-manage-indexes/#create-an-index). You can use just the partition key or a combination of the partition key and sort key of the index to retrieve an item. > **Note:** Catalyst enables you to retrieve a **maximum of 100 items** in bulk from a NoSQL table with pagination from a single SDK operation. You must use the `start_key` token received in the SDK response and construct the logic for pagination. You can define the key condition that identifies the item by specifying the attributes, their required values, and the supported operator to be used. The supported operators are represented as shown below.
Operators Notation
CONTAINS contains
NOT_CONTAINS not_contains
BEGINS_WITH begins_with
ENDS_WITH ends_with
IN in
The following example code snippet details the following logic: * The required query is executed by referring the required items using the index `FruitIdentifier`’s partition key `fruitColor`. * The condition value is specified as "`yellow`". * The query is done using the `queryIndex()` SDK method. * Implements consistent_read to indicate if the read operation must be done using the master or a slave cluster. - If the value is set as `true`, it is queried from the master. - If the value is set as `false`, it is queried from the slave. > **Note:** In the master-slave replication, the master contains all the data of the database, and the slave contains copies from the master. Performing a read operation from the slave can reduce the overall cost with the trade-off being a minor delay in the updated data being reflected. ```javascript const { NoSQLMarshall, NoSQLEnum } = require('zcatalyst-sdk-node/lib/no-sql'); const { NoSQLOperator } = NoSQLEnum; // Query a NoSQL table index to fetch the items identified by the partition key fruitColor with the value "yellow" const queriedIndexItems = await table.queryIndex('FruitIdentifier', { // Define the key condition to query the items with key_condition: { attribute: 'fruitColor', // Define the supported operator to be used operator: NoSQLOperator.EQUALS, value: NoSQLMarshall.makeString('yellow') }, // Set consistent_read to true to query from master. If set to false, it is queried from slave. consistent_read: true, // Limit the number of rows to be returned by specifying a value limit: 15, // Set forward_scan to true to sort the results in ascending order. Otherwise, it is sorted in descending order. forward_scan: true }); ```