Skip to main content
Version: 3.4.x

Search Data Service

The Search Data 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 send / Kafka receive actions in tandem with Elastic Search mechanisms.

tip

The new Search Data microservice leverages Elastic Search to execute searches based on indexed keys, using existing mechanisms.

caution

Enabling Elastic Search indexing requires activating the configuration in the FLOWX.AI Engine. Refer to the Search Data Service Setup Guide for detailed instructions.

Using the Search Data 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"

  • one process where we look for data - in our example "add_new_clients"

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.

caution

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

Example of MVEL Business Rule:

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:

  1. Create a process using the
    The fallback content to display on prerendering
    .
  2. OPTIONAL: Add a Task node within the process. Configure this node and add a business rule if you want to customize the display of results, e.g:
output.put("searchResult", {"result": []});
output.put("resultsNumber", 0);
tip

For displaying results in the UI, you can also consider utilizing Collections UI element.

  1. Add a user task and configure a send event using a Kafka send action. Configure the following parameters:
  • Topic name: The Kafka topic for the search service requests (defined at KAFKA_TOPIC_DATA_SEARCH_IN env variable in your deployment).

  • Body message:
{
"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": ["ANY",...] //optional, if you want to filter process instances based on their status
}
info

Check the Understanding the Process Status Data for more example of possible states.

  • searchKey - process key used to search data stored in a process
caution

Indexing this key within the process is crucial for the search data service to effectively locate it. To enable indexing, navigate to your desired process definition and access Process Settings โ†’ Task Management โ†’ Search indexing.

โ—๏ธ 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.

  • 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

  • Data to send (key): Used for validating data sent from the frontend via an action (refer to User Task configuration section)
  • Headers: Mandatory - {"processInstanceId": ${processInstanceId}}
caution

If you also use callbackActions, you will need to also add the following headers: {"destinationId": "search_node", "callbacksForAction": "search_for_client"}

  • Example (dummy values extracted from a process):

  1. A custom microservice (a core extension) will receive this event and search the value in the Elastic Search.
  2. 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.

The response's body message will look like this:

  • If there is no result:
{
"result": [],
"searchKey": "application.client.name.identificationData.lastName",
"tooManyResults": "false",
"searchValue": "random"

}

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.

  • If there is a list of results:
{

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

NOTE: Up to 50 results will be received if tooManyResults is true.

Example with dummy values extracted from a process:

For deployment and service setup instructions, refer to the:

ยปSearch Data Service Setup Guide

Was this page helpful?