Storing form submissions in ElasticSearch
This topic shows you how to:
- Configure Elasticsearch storage and enable saving of submissions to an Elasticsearch server.
- Migrate existing forms with results stored in the JCR.
To store form results in Elasticsearch, you need:
- A website that has Form Factory enabled.
- Elasticsearch correctly configured in DX. If you have not done so, this install guide shows how to get up and running with DX and Elasticsearch.
Configuring Elasticsearch storage
To configure Elasticsearch as a datasource for submitted forms, you enable an Elasticsearch extension module for your web project and then enable Elasticsearch for a specific form.
Enabling an extension module
To save results to Elasticsearch, you must deploy and enable an extension module containing this functionality on your site.
To enable the extension module:
- In DX, navigate to Administration>Web projects and edit the modules that deploy with the project.
- Add Form Factory Elasticsearch Storage (form-factory-elasticsearch-storage) to the list of deployed modules.
- Choose Next to save your changes.
Enabling Elasticsearch for a form
To enable saving form submissions to an Elasticsearch datatable, you add a Save to Elasticsearch action to the form and specify an Elasticsearch database connection.
To enable Elasticsearch for a form:
- In Form Factory Builder, choose the form that you want to save submissions for in Elasticsearch.
- In the Form Builder, click Action step to show actions associated with the form.
- Click Add action . In the side pane, select Save to Elasticsearch and click Close.
The Save to Elasticsearch action displays in the list of actions for the form.
- Next, specify the database connection for the action. Click Edit action .
- In the Edit action pane, select an Elasticsearch connection from the Elasticsearch Connection list, as shown in the following example. Then, click Close.
- Click Save changes to form .
- Publish the form.
After publishing the form, form results are stored in Elasticsearch. Note that you can continue to use the Save to JCR action to store results in both data sources simultaneously.
Migrating form data from a JCR
You can migrate form results from a form that uses the JCR as a storage medium.
To migrate form results from a JCR:
- The form must have the Save to Elasticsearch action enabled and have submissions saved in the JCR
- Your role requires the formFactoryResultsAdmin permission
To migrate form data from a JCR:
- Navigate to Site Settings>Form Factory>View/Exploit forms results and select Elasticsearch - Datatable for the form that you want to migrate.
The Elasticsearch option is only available if the form is published and has the Save to Elasticsearch action enabled.
- In the Elasticsearch results view page, select Start migration to start the migration.
When the migration completes, form results display in an Elasticsearch data table. You can now explore form results as you normally would.