3.2.15 Elastic Search

Orbita uses Elastic Search, a highly scalable, open-source, full-text search analytics engine. The use of Elastic search enhances the Chatbot users' experience by providing quick and accurate results.

How to leverage Elastic search capabilities?

In Orbita, every document you create will be stored in the Elastic search database. This makes it easier for you to search and retrieve content accurately.

Schema

A schema enables us to create a collection. The schema is like a skeleton for each document where you fill in the information. To hold this information we need to create a schema. Refer

Index the documents

After the schema is created, index the schema. By indexing the schema, any new documents added to the schema are automatically indexed by Elastic search. Refer,

Experience Designer

Using the Search node, you can query against the data and retrieve the results that match the specified criteria. Refer,

Example

Create a schema with the fields facility name, facility image, address, phone number, location (latitude and longitude), etc.

Sample schema (facilitydata) used in this example is:

{ "fields": [ { "type": "String", "fieldType": "text", "ref": "", "options": [], "multiple": false, "validation": [ { "required": false } ], "isDefault": false, "label": "Hospital Name", "key": "hospitalname" }, { "type": "String", "fieldType": "text", "ref": "", "options": [], "multiple": false, "validation": [ { "required": false } ], "isDefault": false, "label": "City", "key": "city" }, { "type": "Object", "fieldType": "json", "ref": "", "options": [], "multiple": false, "validation": [ { "required": true } ], "isDefault": false, "label": "Location Object", "key": "location", "es": "geo_point" } ] }

You can query for any of these fields and get the document and render the information to the chatbot.
For example, if you wanted to know all the hospitals that are available in Davenport city, you can query for the city name and get the results.

The sample document with the above schema is shown below.

In the Experience Designer, construct a flow as shown.

Place the below code in the City name search function node:

queriedCity = msg.payload.request.intent.slots.city_slot.value msg.payload.q = { "query": { "bool": { "must": { "match": { "city": queriedCity } } } } } return msg;

The Search node configuration is as follows:

{ "q" : "{{msg.payload.q}}" }

Place the below code in the Hospital Names function node:

The say node configuration is as follows:

Export file for the Experience Designer flow:

  File Modified

File ElasticSearch_CityName_Search.json

May 18, 2021 by Rajkiran Alla

 

In the chatbot, if the chatbot user says Davenport, the Search node will get the hospital names that have the city field as Davenport.

 

Video Content

https://cdn.orbita.cloud/assets/orbita/experiencedesigner/elasticsearch.mp4

Supporting Documentation

Useful Links

http://orbita.ai

Related Content