# Order Search The Order Search feature is intended for merchants to perform searches on a large number of Orders in a Project. This feature is **not** intended for searching through a customer's order history in a storefront application. The Order Search API does not return the resource data of the matching Orders. Instead, it returns a list of Order IDs, which can then be used to fetch the [Orders by their ID](/urn?urn=ctp%3Aapi%3Aendpoint%3A%2F%7BprojectKey%7D%2Forders%2F%7Bid%7D%3AGET). Only Orders from the last **3 months** are indexed and can be retrieved. Since the [response](/api/projects/order-search.md#hit) also contains the version of the matching Order, it allows you to: - maintain a cache of Orders, - compare version numbers to detect outdated Orders, - detect if the search index for an Order is out of date and react accordingly (for example display a warning, or [initiate an update](/api/projects/order-search.md#initiate-update) of the Order search index). ## Activation of the API The Order Search API is not active for the Project by default. If the API is deactivated for your Project, the [Search Orders](/api/projects/order-search.md#search-orders) endpoint returns a [Not Found](/api/errors.md#404-not-found) error. To activate the API for your Projects, choose one of the following options: - using the [Change Order Search Status](/api/projects/project.md#change-order-search-status) update action on the Project API. - contacting the [commercetools support team](https://support.commercetools.com/) and provide the region, project key(s), and use case(s). Once the Project setting has been changed, the indexing of Orders from the **last 3 months** within the Project will start and the [Search Orders](/api/projects/order-search.md#search-orders) endpoint will become fully functional soon after. ### Automatic deactivation The Order Search API is automatically deactivated for a Project if there have been no calls to the [Search Orders](/api/projects/order-search.md#search-orders) endpoint in the last 30 days. The API can be reactivated again using any of the options listed in [Activation of the API](/api/projects/order-search.md#activation-of-the-api). ## Representations #### OrderSearchRequest [type definition](/api/projects/order-search.md?urn=ctp:api:type:OrderSearchRequest). #### OrderPagedSearchResponse [type definition](/api/projects/order-search.md?urn=ctp:api:type:OrderPagedSearchResponse). ##### Hit [type definition](/api/projects/order-search.md?urn=ctp:api:type:Hit). ## Search Orders If this endpoint responds with [Not Found](/api/errors.md#404-not-found) error, the feature has been deactivated due to inactivity and must be [reactivated](/api/projects/order-search.md#activation-of-the-api) before API requests will succeed. Use the [Check if Order Search index exists](/api/projects/order-search.md#check-if-order-search-index-exists) endpoint to see if there is an index available. [endpoint definition](/api/projects/order-search.md?urn=ctp:api:endpoint:/\{projectKey}/orders/search:POST). ## Check if Order Search index exists [endpoint definition](/api/projects/order-search.md?urn=ctp:api:endpoint:/\{projectKey}/orders/search:HEAD). On the [GraphQL endpoint](/api/projects/order-search.md#graphql-endpoint) you can use following query: ```graphql query FetchIndicesExists { ordersIndicesExist { searchableIndexExists newInProgress } } ``` The query response contains the following fields indicating the status of the search index: - `searchableIndexExists` - the index exists and Orders can be searched. - `newInProgress` - the index is being created by a job. Use the `reIndexAllOrders` mutation to get the job ID. Find below an example for a `FetchIndicesExists` query to be executed as cURL command: ```bash $ curl -X POST https://api.{region}.commercetools.com/{projectKey}/orders/indexer/graphql -H "Content-Type:application/json" -H "Authorization:Bearer ..." -d '{"query": "{ ordersIndicesExist { searchableIndexExists } }" }' ``` ## Searchable Order fields The following list contains the [Order](/urn?urn=ctp%3Aapi%3Atype%3AOrder) fields that are supported in [simple expressions](/api/#simple-expressions). Some fields containing data of referenced resources are not updated automatically. Their values are kept in the their original state, even if the referenced resource was changed. You need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the most recent values for those fields. ### Number and date fields Use the following fields in [exact](/api/search-query-language.md#exact), [exists](/api/search-query-language.md#exists), and [range](/api/search-query-language.md#range) expressions. **Data type** indicates the [type of field](/api/search-query-language.md#types-of-fields) for the field. | Standard field | Data type | Query for Orders | | --- | --- | --- | | `completedAt` | **dateTime** | completed at a certain date and time. | | `createdAt` | **dateTime** | created at a certain date and time. | | `lastModifiedAt` | **dateTime** | last modified at any of its fields at a certain date and time. | | `version` | **long** | with a certain version of the resource. | | `customLineItems.state.quantity` | **long** | with Custom Line Item's [ItemState](/urn?urn=ctp%3Aapi%3Atype%3AItemState) of a certain quantity.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `lineItems.state.quantity` | **long** | with Line Item's ItemState of a certain quantity. | | `returnInfo.items.createdAt` | **dateTime** | with [ReturnItems](/api/projects/orders.md#returnitem) created at a certain date and time. | | `returnInfo.items.lastModifiedAt` | **dateTime** | with ReturnItems last modified at a certain date and time. | | `returnInfo.returnDate` | **dateTime** | with [ReturnInfo](/urn?urn=ctp%3Aapi%3Atype%3AReturnInfo) of a certain date and time. | | `totalPrice.centAmount` | **long** | with a total price of a certain amount. | ### Phone fields Use the following **text** [type fields](/api/search-query-language.md#types-of-fields) in [exact](/api/search-query-language.md#exact), [fullText](/api/search-query-language.md#fulltext), [prefix](/api/search-query-language.md#prefix), and [exists](/api/search-query-language.md#exists) expressions. On these fields all non numeric characters are ignored in search requests. For example, a query of type [fullText](/api/projects/order-search.md#fulltext) for `(783) 627-3740` will also match `(783) 6273740`. The same applies to [prefix](/api/projects/order-search.md#prefix) queries. Special characters are only taken into account when performing queries of type [exact](/api/projects/order-search.md#exact). | Standard field | Query for [Orders](/api/projects/orders.md#order) with | | --- | --- | | `billingAddress.mobile` | a billing address of a certain mobile number. | | `billingAddress.phone` | a billing address of a certain phone number. | | `itemShippingAddresses.mobile` | a Line Item shipping address of a certain mobile number. | | `itemShippingAddresses.phone` | a Line Item shipping address of a certain phone number. | | `shippingAddress.mobile` | a shipping address of a certain mobile number. | | `shippingAddress.phone` | a shipping address of a certain phone number. | ### Text fields Use the following **text** [type fields](/api/search-query-language.md#types-of-fields) in [exact](/api/search-query-language.md#exact), [fullText](/api/search-query-language.md#fulltext), [prefix](/api/search-query-language.md#prefix), [wildcard](/api/search-query-language.md#wildcard), and [exists](/api/search-query-language.md#exists) expressions. | Standard field on Order | Query for [Orders](/api/projects/orders.md#order) | | --- | --- | | `all` | with a certain string in the combination of all fields. | | `country` | with a certain country. | | `createdBy.clientId` | created by an API Client with a certain client ID. | | `customerEmail` | with a certain Customer email address. | | `customerGroup.key` | from Customers of a certain Customer Group specified by its `key`.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `customerGroup.name` | from Customers of a certain Customer Group specified by its `name`.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `lastModifiedBy.clientId` | last modified by an API Client with a certain client ID. | | `orderState` | with a certain [OrderState](/urn?urn=ctp%3Aapi%3Atype%3AOrderState). | | `paymentState` | with a certain [PaymentState](/urn?urn=ctp%3Aapi%3Atype%3APaymentState). | | `shipmentState` | with a certain [ShipmentState](/urn?urn=ctp%3Aapi%3Atype%3AShipmentState). | | `state.name` | with a [State](/api/projects/states.md) of a certain name for the `language` specified in the expression.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `store.name` | with a [Store](/api/projects/stores.md) of a certain name for the `language` specified in the expression.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | Standard field on Billing Address | Query for Orders with a billing address of | | --- | --- | | `billingAddress.city` | a certain city. | | `billingAddress.company` | a certain company. | | `billingAddress.country` | a certain country. | | `billingAddress.firstName` | a certain first name. | | `billingAddress.lastName` | a certain last name. | | `billingAddress.postalCode` | a certain post code. | | Standard field on Item Shipping Address | Query for Orders with a Line Item Shipping address of | | --- | --- | | `itemShippingAddresses.city` | a certain city. | | `itemShippingAddresses.company` | a certain company. | | `itemShippingAddresses.country` | a certain country. | | `itemShippingAddresses.firstName` | a certain first name. | | `itemShippingAddresses.lastName` | a certain last name. | | `itemShippingAddresses.postalCode` | a certain post code. | | Standard field on Shipping Address | Query for Orders with a Shipping address of | | --- | --- | | `shippingAddress.city` | a certain city. | | `shippingAddress.company` | a certain company. | | `shippingAddress.country` | a certain country. | | `shippingAddress.firstName` | a certain first name. | | `shippingAddress.lastName` | a certain last name. | | `shippingAddress.postalCode` | a certain post code. | | Standard field on Line Items and Custom Line Items | Query for Orders with | | --- | --- | | `lineItems.productId` | Line Items of a certain Product with a specified `id`. | | `lineItems.variant.sku` | Line Items of a certain Product Variant with a specified `sku`. | | `lineItems.name` | Line Items of a certain Product `name` for the `language` specified in the expression. | | `lineItems.state.state.name` | Line Items of a certain State name for the `language` specified in the expression.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `customLineItems.name` | Custom Line Items of a certain name for the `language` specified in the expression.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `customLineItems.state.state.name` | Custom Line Items of a certain State name for the `language` specified in the expression.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | Standard field on Payment, Return, or Shipping Info | Query for Orders with | | --- | --- | | `paymentInfo.payments.paymentMethodInfo.method` | a certain payment method.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `returnInfo.items.shipmentState` | return items in a certain shipment state. | | `returnInfo.items.paymentState` | return items with a certain payment state. | | `shippingInfo.shippingMethodName` | a certain Shipping Method. | ### Keyword fields Use the following **keyword** [type fields](/api/search-query-language.md#types-of-fields), containing unique IDs or keys, in [exact](/api/search-query-language.md#exact), [prefix](/api/search-query-language.md#prefix), [wildcard](/api/search-query-language.md#wildcard), and [exists](/api/search-query-language.md#exists) expressions. To query for multiple values of the same field or for several fields in the same request, combine the simple expressions with a [compound expression](/api/search-query-language.md#compound-expressions). | Standard field on Order | Query for | | --- | --- | | `id` | an [Order](/urn?urn=ctp%3Aapi%3Atype%3AOrder) with a specific `id`. | | `orderNumber` | an Order with a specific `orderNumber`. | | `createdBy.anonymousId` | Orders created by anonymous session with a specific ID. | | `createdBy.externalUserId` | Orders created by a Customer using external OAuth with a specific user ID. | | `lastModifiedBy.anonymousId` | Orders last modified by anonymous session with a specific ID. | | `lastModifiedBy.externalUserId` | Orders last modified by a Customer using external OAuth with a specific user ID. | | `origin` | Orders with a specific `origin`. | | `customerGroup.id` | Orders from Customers of a certain Customer Group specified by its `id`. | | `customLineItems.state.state.key` | Custom Line Items with a certain [State](/api/projects/states.md) specified by its `key`.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `lineItems.state.state.key` | Line Items with a certain State specified by its `key`.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `paymentInfo.payments.interfaceId` | a [Payment](/urn?urn=ctp%3Aapi%3Atype%3APayment) of a certain `interfaceId`.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `paymentInfo.payments.transactions.id` | a Payment [Transaction](/urn?urn=ctp%3Aapi%3Atype%3ATransaction) of a certain `id`.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `paymentInfo.payments.transactions.interactionId` | a Payment [Transaction](/urn?urn=ctp%3Aapi%3Atype%3ATransaction) of a certain `inferactionId`.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `returnInfo.returnTrackingId` | a certain `returnTrackingId` on the [ReturnInfo](/urn?urn=ctp%3Aapi%3Atype%3AReturnInfo).You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `shippingInfo.deliveries.parcels.trackingData.trackingId` | a certain `trackingId` on a Parcel's [TrackingData](/urn?urn=ctp%3Aapi%3Atype%3ATrackingData).You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `state.key` | Orders with a certain [State](/api/projects/states.md) specified by its `key`.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `store.key` | Orders with a certain [Store](/api/projects/stores.md) specified by its `key`.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `totalPrice.currencyCode` | Orders with a total price of a certain [CurrencyCode](/api/types.md#currencycode). | ### Custom Fields In addition to the standard fields on an Order, you can also search for its [Custom Fields](/api/projects/custom-fields.md), if any. | Custom Field on Order, Payment, and Transaction | Query for Orders | | --- | --- | | `custom.` | with a [Custom Field](/api/projects/custom-fields.md#fieldcontainer) of a specific `name`. | | `paymentInfo.payments.custom.` | with [Payments](/api/projects/payments.md#payment) with a Custom Field of a specific `name`.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | | `paymentInfo.payments.transactions.custom.` | with Payment [Transactions](/api/projects/payments.md#transaction) with a Custom Field of a specific `name`.You may need to [initiate an update](/api/projects/order-search.md#initiate-update) to get the latest state of this field. | To determine the data type of the Custom Field, you must provide the `customType` in [simple expressions](/api/projects/order-search.md#simple-expressions). #### CustomType [type definition](/api/projects/order-search.md?urn=ctp:api:type:OrderSearchCustomType). #### Query expression supported for which CustomType A checkmark indicates which [simple expression](/api/projects/order-search.md#simple-expressions) you can use for which [CustomType](/api/projects/order-search.md#customtype) of field. You can apply the same expressions for the `SetType` of the CustomType as for the individual CustomType itself. | CustomType | [exact](/api/search-query-language.md#exact) | [fullText](/api/search-query-language.md#fulltext) | [prefix](/api/search-query-language.md#prefix) | [range](/api/search-query-language.md#range) | [wildcard](/api/search-query-language.md#wildcard) | [exists](/api/search-query-language.md#exists) | | :--- | :---: | :---: | :---: | :---: | :---: | :---: | | `BooleanType` | ✓ | | | | | ✓ | | `NumberType` | ✓ | | | ✓ | | ✓ | | `StringType`, `EnumType`, `DateType`, `TimeType`, `DateTimeType` | ✓ | ✓ | ✓ | | ✓ | ✓ | | `LocalizedStringType`, `LocalizedEnumType` | ✓ | ✓ | ✓ | | ✓ | ✓ | #### Examples An [exact](/api/search-query-language.md#exact) query on a `StringType` Custom Field. ```json { "query": { "exact": { "field": "custom.myOrderField", "value": "special order", "customType": "StringType" } } } ``` An [exists](/api/search-query-language.md#exists) query on a `SetType` of `DateType` Custom Field searching through all values for the Custom Field: ```json { "query": { "exists": { "field": "custom.myDateField", "value": "2021-05-10", "customType": "SetType.DateType" } } } ``` ## Order Search Query The query expressions to be used for the `query` field on [OrderSearchRequest](/api/projects/order-search.md#ordersearchrequest), as well as for the [Advanced Order Search](/merchant-center/order-list.md#advanced-order-search) in the Merchant Center, are documented for multiple Search APIs on the [Search query language](/api/search-query-language.md) page. Search query language terms specific to Order Search are documented on this page. ### Simple expressions The `field` in [simple expressions](/api/search-query-language.md#simple-expressions) can have any of the [searchable Order fields](/api/projects/order-search.md#searchable-order-fields), like `orderNumber`, `createdAt`, `country` including fields of nested objects like LineItems (`lineItems.productId`) or ShippingMethods (`shippingAddress.firstName`). For Order Search simple expressions with [Custom Fields](/api/projects/custom-fields.md), the `customType` field must be used instead of the `fieldType` field that is documented for the generic [search query language](/api/search-query-language.md#simple-expressions). ### Compound expressions For [compound expressions](/api/search-query-language.md#compound-expressions), the following restriction applies to Order Search: A compound expression can only be used one time on the same level of composition. For example, this composition of two `and` expressions is not supported: Z = (A `and` B `and` C) using only one `and` expression, like: X = (A `and` B), is allowed. Using a different compound expression is allowed too, like for: Y = (A `and` B `or` C). Z can still be specified by (X `and` C) since X is a compound expression on a different level then. ### Example queries #### fullText A [fulltext](/api/search-query-language.md#fulltext) query for Orders that have "yellow car" as the English `name` for any Custom Line Item in the Order. ```json { "query": { "fullText": { "field": "customLineItems.name", "language": "en", "value": "yellow car", "mustMatch": "any" } } } ``` #### exact An [exact](/api/search-query-language.md#exact) query for Orders that have the SKU "chiquita\_yellow\_123" in any of the Line Items in the Order. The case of the SKU is ignored. ```json { "query": { "exact": { "field": "lineItems.variant.sku", "value": "chiquita_yellow_123", "caseInsensitive": true } } } ``` #### prefix A [prefix](/api/search-query-language.md#prefix) query for Orders with customer emails starting with "commercetoo". The case of the email address is ignored. ```json { "query": { "prefix": { "field": "customerEmail", "value": "commerceto", "caseInsensitive": true } } } ``` #### range A [range](/api/search-query-language.md#range) query for Orders last modified between two specific dates: ```json { "query": { "range": { "field": "lastModifiedAt", "gte": "2018-08-25T12:00:00.000Z", "lte": "2018-08-26T12:00:00.000Z" } } } ``` #### wildcard A [wildcard](/api/search-query-language.md#wildcard) query for Orders with customer emails that start with "ab" and may or may not contain any additional characters. ```json { "query": { "wildcard": { "field": "customerEmail", "value": "ab*@commercetools.com" } } } ``` A [wildcard](/api/search-query-language.md#wildcard) query for Orders with customer emails that start with "ab" and have exactly one additional character after that. Case is ignored. ```json { "query": { "wildcard": { "field": "customerEmail", "value": "ab?@commercetools.com", "caseInsensitive": true } } } ``` The similar wildcard expression as before, but now with another wildcard in the same `value`. The email domain can be any as long as it ends with ".com". ```json { "query": { "wildcard": { "field": "customerEmail", "value": "ab?@*.com", "caseInsensitive": true } } } ``` #### exists An [exists](/api/search-query-language.md#exists) query for Orders that have the field `customerEmail` set: ```json { "query": { "exists": { "field": "customerEmail" } } } ``` #### Compound expression AND Example of a query with compound expression finding orders with a specific price: ```json { "query": { "and": [ { "exact": { "field": "totalPrice.currencyCode", "value": "EUR" } }, { "exact": { "field": "totalPrice.centAmount", "value": 2222 } } ] } } ``` #### Compound expression OR with boost Orders that have `butter` in the `lineItems.name` field are scored as more relevant than those that have `butter` in their `customLineItems.name` field. ```json { "query": { "or": [ { "fullText": { "field": "lineItems.name", "language": "en", "value": "butter", "boost": 2 } }, { "fullText": { "field": "customLineItems.name", "language": "en", "value": "butter" } } ] } } ``` #### Compound expression NOT Use the [not](/api/search-query-language.md#not-expression) compound expression to exclude Orders that match a condition. The following query returns Orders that do not have any Line Item in the `cancelled` State: ```json { "query": { "not": [ { "exact": { "field": "lineItems.state.state.key", "value": "cancelled" } } ] } } ``` On embedded arrays, like `lineItems` or `customLineItems` of an Order, the `not` compound expression can be applied to express that **all elements** of the array must match the condition. For an example query to find Orders where every Line Item is in the `shipped` State, see [Search query language](/api/search-query-language.md#not-expression). ## Sorting Sorting allows you to control how the results of your search query are sorted. If no sort is specified, the results are sorted by relevance in descending order. For more information about sorting the Order Search result, see the [search query language](/api/search-query-language.md#searchsorting) documentation. **Example:** The following expression sorts the results ascending by the English Line Item name, but filtered on a specific Product ID: ```json { "sort": [ { "field": "lineItems.name", "language": "en", "order": "asc", "filter": { "exact": { "field": "lineItems.productId", "value": "4054a159-7f3e-4fe9-a30c-8db80ca7d665" } } } ] } ``` Note that you can only filter on the same parent field you sort by. In this case on the root of the Order. ## Pagination A response to the search request contains the first 10 results by default. Pagination allows you to retrieve the first 10000 results by requesting them page by page. The `total` field in a search query result indicates how many results match the search query in total. ### Limit The `limit` field allows you to set the maximum number of results returned on a page. Any value between `0` and `100` is allowed, the default limit is `10`. ### Offset The `offset` field allows you to control which page number you want to retrieve. The default value is `0`, meaning you retrieve the first page of query results containing as many results as specified by `limit`. A value of `1` will skip the first page of results, and your result contains the second bucket of results with the specified `limit`. The maximum offset is between `9 900` and `10 000` depending on the `limit` parameter. That is, if you set the `limit` parameter to its maximum value of `100`, the maximum `offset` is `9 900`. If you use the default page limit of `10`, you can set the maximum `offset` value to `9 990`. Since you can only retrieve the first 10000 results in total, a higher offset would exceed that limit. In such a case, the API responds with an error. ## Search Index updates As the number of Orders in the Project grows over time and Order States change on the existing Orders, the Order Search index has to be kept in sync with the changes. ### Automatic updates The Order Search index is **automatically updated** whenever there is a change to an Order. However, this update mechanism only applies to **changes to the Order resource itself**. Data for resources referenced by an Order, such as [Payments](/api/projects/payments.md), [States](/api/projects/states.md), or [Stores](/api/projects/stores.md), are initially indexed if they exist when the Order is created, but subsequent changes to these resources will **not trigger an update** to the Order Search index. You can update the information in these [searchable Order fields](/api/projects/order-search.md#searchable-order-fields) by initiating an update as described in the next section. ### Initiate update If you notice that the [Search Orders](/api/projects/order-search.md#search-orders) endpoint is not returning the most recent Orders, you can initiate a search index rebuild. When a Project is re-indexed, all existing Orders from the **last 3 months** are re-processed to update the search index. This ensures that any changes made to the Orders, including state transitions or updates to Order details, are accurately reflected in search results. Re-indexing can take several hours, depending on the volume of Orders. This service is provided on a [GraphQL endpoint](/api/projects/order-search.md#graphql-endpoint) by submitting a specific [reindex mutation](/api/projects/order-search.md#reindex-mutation). #### Reindex mutation OAuth 2.0 Scopes: `manage_project_settings:{projectKey}`, `view_orders:{projectKey}` ```graphql mutation ReindexAllOrders { reIndexAllOrders { indexingJobId existingIndexingJobId } } ``` This mutation returns following indexing job IDs: - `indexingJobId` is the ID of a new indexing job. - `existingIndexingJobId` is the ID of an already running job making progress. #### Check indexing progress For each indexing job ID you can check the status of the respective jobs like so: OAuth 2.0 Scopes: `manage_project_settings:{projectKey}`, `view_orders:{projectKey}` ```graphql query GetReindexingStatus($jobId: String!) { getReindexingStatus(id: $jobId) { nbrOfIndexedDocuments nbrOfFailedDocuments totalNbrOfDocuments percentCompleted completed } } ``` #### Stop indexing jobs You can stop the indexing of all Orders with following mutation: OAuth 2.0 Scopes: `manage_project_settings:{projectKey}` ```graphql mutation StopIndexingOrders { stopOrdersIndexing { status } } ``` The response contains the `status` of the indexing job. #### GraphQL endpoint You can access the GraphQL endpoint with following URL: ```bash https://api.{region}.commercetools.com/{projectKey}/orders/indexer/graphql ``` The endpoint accepts HTTP POST requests with following fields in a JSON body: - `query` - String - GraphQL query as a string - `variables` - Object - Optional - containing JSON object that defines variables for your query - `operationName` - String - Optional - the name of the operation, in case you defined several of them in the query #### GraphQL Explorer To explore the GraphQL endpoint, you can use the GraphQL Explorer in the [Merchant Center](/merchant-center/developer-settings.md#graphql-explorer). ## Related pages - [Area overview page with navigation](/api.md) - [Previous page: Order Import](/api/projects/orders-import.md)