How to Index Data from Salesforce in SearchBlox
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 – Giving SQL Query
To fetch data from Salesforce a query must be provided. The query format is shown below.
SELECT <index field> as uid , <column name2> as title, <column name3> as content FROM <tablename> LIMIT 100
Some of the commonly used tables and common queries for the same in Salesforce
SELECT * FROM Account
SELECT * FROM Lead
SELECT * FROM Cases
For more data tables that can be indexed from Salesforce please use the link below:
If you have more than 100 entries in a table (eg: Account), specify the number of documents to be indexed by giving LIMIT value in the query. For example:
SELECT * FROM Account LIMIT 300
Otherwise, a minimum of 100 rows would be indexed.
Task 3 – Getting a Security Token from Salesforce
Go to Salesforce and log in to your account. Click View Profile in the top right corner. Click Settings and select Reset My Security Token from the lefthand menu as shown in the screenshot below:
Click Reset Security Token to receive an email with the security token. This token has to be used in the Database URL String in Database collection settings.
Task 4 – Database Collection Settings
- Select database type as Salesforce from the dropdown menu.
- Enter the database URL string in the format below:
Enter the username, password and security token received through email in the string.
- Save the settings.
- Check the settings by clicking the Test Database Collection Please 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 Salesforce can be visualized using Kibana.
The example below uses the maximum number of fields available in the datatable account. The query to provide is
SELECT * FROM Account
Steps in Kibana
1. 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 one above.
Sample visualization generated for Salesforce data indexed in SearchBlox: