Storing form submissions in ElasticSearch

November 14, 2023

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 Forms enabled.
  • Elasticsearch correctly configured in Jahia. If you have not done so, this install guide shows how to get up and running with Jahia 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:

  1. In Jahia, navigate to Administration>Web projects and edit the modules that deploy with the project.
  2. Add Forms Elasticsearch Storage (form-factory-elasticsearch-storage) to the list of deployed modules.
  3. 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.

Note: You must that first configure the Elasticsearch database connection in Administration>Configuration>Database Connector.

To enable Elasticsearch for a form:

  1. In Forms Builder, choose the form that you want to save submissions for in Elasticsearch.
  2. In the Form Builder, click Action step 
    to show actions associated with the form.
  3. 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.
  4. Next, specify the database connection for the action. Click Edit action 
  5. In the Edit action pane, select an Elasticsearch connection from the Elasticsearch Connection list, as shown in the following example. Then, click Close.
  6. Click Save changes to form
  7. 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
Note: Once a migration has completed, further migrations are unavailable unless all indexes from the previous migration have been deleted.

To migrate form data from a JCR:

  1. Navigate to Site Settings>Forms>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.
  2. 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.