> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# FlowX.AI Data Search

> The Data Search service is a microservice that enables data searches within other processes. It facilitates the creation of processes capable of conducting searches and retrieving data by utilizing Kafka actions in tandem with Elasticsearch mechanisms.

<Tip>
  Data Search service leverages Elasticsearch to execute searches based on indexed keys, using existing mechanisms.
</Tip>

## Using the Data Search service

### Use case

* Search for data within other processes
* Display results indicating where the search key was found in other processes

For our example, two process definitions are necessary:

* one process used to search data in another process - in our example ***"search\_process\_CDN"***

<Frame>
  ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/search_in_another_proc_34.png)
</Frame>

* one process where we look for data - in our example ***"add\_new\_clients"***

<Frame>
  ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/search_populate_data.png)
</Frame>

## Add data process example

Firstly, create a process where data will be added. Subsequently, the second process will be used to search for data in this initial process.

<Frame>
  ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/addDataProc.png)
</Frame>

<Warning>
  In the "Add Data Process Example" it's crucial to note that we add mock data here to simulate existing data within real processes.
</Warning>

Example of MVEL Business Rule:

```json theme={"dark"}
output.put ("application", {
  "date": "22.08.2022",
    "client": {
      "identificationData": {
        "firstName": "John",
        "lastName": "Doe",
        "cityOfBirth": "Anytown",
        "primaryDocument": {
          "number": 123456,
          "series": "AB",
          "issuedCountry": "USA",
          "issuedBy": "Local Authority",
          "issuedAt": "01.01.2010",
          "type": "ID",
          "expiresAt": "01.01.2030"
        },
        "countryOfBirth": "USA",
        "personalIdentificationNumber": "1234567890",
        "countyOfBirth": "Any County",
        "isResident": true,
        "residenceAddress": {
          "country": "USA",
          "city": "Anytown",
          "street": "Main Street",
          "streetNumber": 123
        },
        "mailingAddress": {
          "country": "USA",
          "city": "Anytown",
          "street": "Main Street",
          "streetNumber": 123
        },
        "pseudonym": null
      },
    }
    }
);
```

Now we can play with this process and create some process instances with different states.

## Search process example

Configure the "Search process" to search data in the first created process instances:

<Steps>
  <Step title="Create process">
    Create a process using the [**Process Designer**](../../building-blocks/process/process).
  </Step>

  <Step title="Displaying the results (optional)">
    Add a [**Task node**](../../building-blocks/node/task-node) within the process. Configure this node and add a business rule if you want to customize the display of results, e.g:

    ```java theme={"dark"}
    output.put("searchResult", {"result": []});
    output.put("resultsNumber", 0);
    ```

    <Tip>
      For displaying results in the UI, you can also consider utilizing [**Collections**](../../building-blocks/ui-designer/ui-component-types/collection/) UI element.
    </Tip>
  </Step>

  <Step title="Configure the search node">
    Add a **user task** and configure a send event using a [**Kafka send action**](../../building-blocks/node/message-send-received-task-node#send-message-task). Configure the following parameters:

    <AccordionGroup>
      <Accordion title="Topic name">
        The Kafka topic for the search service requests (defined at `KAFKA_TOPIC_DATA_SEARCH_IN` environment variable in your deployment).

        ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/search_in_topic.png)
      </Accordion>

      <Accordion title="Body message">
        ```json theme={"dark"}
        {
        	"searchKey": "application.client.identificationData.lastName",
        	"value": "12344",
        	"processStartDateAfter": "YYY-MM-DD:THH:MM:SS", //optional, standard ISO 8601 date format
        	"processStartDateBefore": "YYY-MM-DD:THH:MM:SS", //optional, standard ISO 8601 date format
        	"processDefinitionNames": [ "processDef1", "processDef2"],
        	"states": ["STARTED", "FINISHED, ONHOLD"] //optional, depending if you want to filter process instances based on their status, if the parameter is ommited, the process will display all the statuses
        }
        ```

        * **searchKey** - represents the process key used to search data stored in a process

        <Warning>
          Indexing this key within the process is crucial for the Data Search service to effectively locate it. To enable indexing, navigate to your desired process definition and access **Process Settings → Task Management → Search indexing**.

          ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/indexed_key.png)

          ❗️ Keys are indexed automatically when the process status changes (e.g., created, started, finished, failed, terminated, expired), when swimlanes are altered, or when stages are modified. To ensure immediate indexing, select the 'Update in Task Management' option either in the **node configuration** or within **Process Settings → General** tab.
        </Warning>

        * **value** - the dynamic process key added on our input element that will store and send the data entered by a user to the front end

        <Frame>
          ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/searchValue.png)
        </Frame>

        * **states** - `["STARTED", "FINISHED, ONHOLD" "..."]` - depending if you want to filter process instances based on their status, if the parameter is ommited, the process will display all the statuses

        <Info>
          Check the Understanding the [Process Status Data](../../building-blocks/process/process-instance) section for more example of possible states.
        </Info>
      </Accordion>

      <Accordion title="Data to send">
        * **Data to send (key)**: Used for validating data sent from the frontend via an action (refer to **User Task** configuration section)
      </Accordion>

      <Accordion title="Advanced configuration (Headers)">
        * **Headers**: Mandatory - `{"processInstanceId": ${processInstanceId}}`

        <Check>
          If you also use callbackActions, you will need to also add the following headers:
          `{"destinationId": "search_node", "callbacksForAction": "search_for_client"}`
        </Check>
      </Accordion>
    </AccordionGroup>

    <Info>
      Example (dummy values extracted from a process):

      ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/body_message_search_service.png)
    </Info>
  </Step>

  <Step title="Performing the search">
    A custom microservice (a core extension) will receive this event and search the value in the Elasticsearch.
  </Step>

  <Step title="Receiving the response">
    It will respond to the engine via a Kafka topic (defined at `KAFKA_TOPIC_DATA_SEARCH_OUT` env variable in your deployment). Add the topic in the **Node config** of the User task where you previously added the Kafka Send Action.

    <Frame>
      ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/search_result_topic.png)
    </Frame>
  </Step>
</Steps>

### Response

The response's body message will look like this:

#### If there is no result:

```json theme={"dark"}
{
	"result": [],
	"searchKey": "application.client.name.identificationData.lastName",
	"tooManyResults": "false",
	"searchValue": "random"

}
```

<Frame>
  ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/noResults.png)
</Frame>

Example (dummy values extracted from a process):

<Tip>
  To access the view of your process variables, tokens and subprocesses go to **FLOWX.AI Designer > Active process > Process Instances**. Here you will find the response.
</Tip>

#### If there is a list of results:

```json theme={"dark"}
{

	"searchKey": "application.client.identificationData.personalIdentificationNumber"
	"result":[{
			"processInstanceUUID": "UUID",
			"status": "FINISHED",
			"processStartDate": date,
			"data" : {"all data in elastic for that process"}
	}],
	"tooManyResults": true|false
}
```

<Info>
  **NOTE**: Up to 50 results will be received if `tooManyResults` is true.
</Info>

Example with dummy values extracted from a process:

<Frame>
  ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/platform-deep-dive/search_data_response.png)
</Frame>

#### Developer

<Warning>
  Enabling Elasticsearch indexing **requires** activating the configuration in the **FlowX Engine**. Check the [**indexing section**](../../../setup-guides/flowx-engine-setup-guide/configuring-elasticsearch-indexing/) for more details.
</Warning>

<Card title="Data Search setup guide" href="../../../setup-guides/search-data-service-setup-guide" icon="gears">
  For deployment and service setup instructions
</Card>


## Related topics

- [FlowX.AI 5.3.0 Release Notes](/release-notes/v5.x/v5.3.0-december-2025/v5.3.0-december-2025.md)
- [FlowX.AI 5.2.0 Release Notes](/release-notes/v5.x/v5.2.0-november-2025/v5.2.0-november-2025.md)
- [FlowX.AI 5.7.0 Release Notes](/release-notes/v5.x/v5.7.0-april-2026/v5.7.0-april-2026.md)
- [FlowX.AI 5.1.0 Release Notes](/release-notes/v5.x/v5.1.x-lts/v5.1.0-october-2025/v5.1.0-october-2025.md)
- [FlowX.AI 5.4.0 Release Notes](/release-notes/v5.x/v5.4.0-january-2026/v5.4.0-january-2026.md)
