How to Index Data from Gmail in SearchBlox

How to Index Data from Gmail in SearchBlox

Setup Instructions

Task 1 – Create a Database Collection in SearchBlox

Log in to the SearchBlox server via the web interface. Once logged in, adding a collection only takes three clicks.

First, on the SearchBlox admin home screen, click the Add Collection button. The button is located near the top of the screen, just below navigation.


After starting the process of adding a database collection, the next step is to name the collection. SearchBlox collection names are case sensitive and do not allow for either spaces or certain punctuation marks. However, the SearchBlox collection namespace is limited to each server install, which makes naming collections easier. Select Database Collection as the Collection Type.


After naming the collection and selecting Database Collection as the collection type, specify the language or click the Add button. This will add a database collection to the SearchBlox server.

Task 2 – Provide an SQL Query

To fetch data from Gmail, a query must be provided. The query format is shown below.

SELECT as uid , as title, as content FROM LIMIT 100

Example query for Gmail:

SELECT ID as uid, Subject as title, To as description, MessageBody as content FROM Inbox

Reference link:


If you have more than 100 entries in the inbox, specify the number of documents to be indexed by giving a LIMIT value in the query. For example:

SELECT ID as uid, Subject as title, To as description, MessageBody as content FROM Inbox LIMIT 200

Otherwise, a minimum of 100 rows will be indexed.

Task 3 – Database Collection Settings

Select the database type as Gmail from the dropdown menu.
Enter the database URL string in the format below:;password=mypassword;

Enter the Gmail credentials in the string.


Save the settings.
Check the settings by clicking the Test Database Collection Note that the database connection has to be successful for the indexing to work.

Task 6 – Index and Search

Start indexing from the Index tab or dashboard.


After reaching the maximum number of documents, if continuous indexing is not required, click stop.

Search results in regular search and faceted search are shown as follows:




Task 7 – Viewing Search Result in Kibana

Indexed content from Gmail can be visualized using Kibana.

The example below uses the maximum number of fields available in the data table account. The query to provide is SELECT Headers, Labels, Flags, To, From, Subject FROM Inbox


Steps in Kibana

1. Start Kibana

How to start Kibana?

2. Add the collection ID:


3. After adding the index, the fields mapped can be viewed.


4. Create visualizations by following the steps listed in the reference link, provided in Step 1 above.

A sample visualization generated for Gmail data indexed in SearchBlox:


Back to Top