Dynamic Search Interface and Transaction Report Generator - n8n Workflow

Automate Elasticsearch searches using an n8n workflow form trigger. Generate customizable CSV or Text reports for suspicious transactions and save them instantly using this powerful n8n template.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Data analysts or security teams needing a quick, ad-hoc search interface for log or transaction data.

  • Users looking to build custom internal tools without relying on external web frameworks.

  • Administrators who need to generate compliance or audit reports based on time-series data.

  • Developers seeking advanced examples of using the n8n code node for dynamic query construction in a complex n8n workflow.

Overview

Leveraging the power of n8n, this dynamic search pipeline transforms a simple web form input into a sophisticated query against an Elasticsearch index. The core challenge solved by this n8n workflow is bridging the gap between non-technical users and complex database interactions. By starting with an n8n trigger (the Form Trigger), users can define criteria like minimum transaction amount, time range, and customer ID. A key part of this automation is the use of an n8n node dedicated to generating the complex JSON structure required for Elasticsearch's API. Finally, the n8n template automatically formats the results into either a text report or a CSV file, saving it locally for immediate use, providing significant efficiency gains for financial monitoring or DevOps auditing.

How it Works

The process begins when a user submits data through the custom web interface provided by the n8n trigger, the Form Trigger node.


  1. Input Collection: The Search Form n8n node collects criteria such as time range (e.g., 'Last 3 Days') and minimum transaction amount.

  2. Query Generation: The Build Search Query Code n8n node converts the human-readable inputs into a valid Elasticsearch boolean query JSON structure (using now-1h, now-24h, etc., for timestamp filtering). This is a critical step utilizing core logic flow control within the n8n workflow.

  3. Data Retrieval: The Search Elasticsearch HTTP Request n8n node executes this complex query against the specified ES index (e.g., bank_transactions) using basic HTTP authentication.

  4. Report Formatting: The Format Report Code n8n node processes the returned JSON hits. Based on the user's selection, it generates a structured Text Report or a precise CSV file, packaging the output as binary data ready for saving.

  5. File Output: The final Read/Write Files from Disk n8n node saves the binary report content to the server's /tmp/ directory, completing the automated report generation cycle defined by this n8n template.

Installation Guide


  1. Import: Copy the provided n8n workflow JSON and import it directly into your n8n instance.

  2. Credentials Setup: Locate the Search Elasticsearch HTTP Request n8n node. You must set up a Generic Credential Type (HTTP Basic Auth) defining the username and password necessary to access your Elasticsearch cluster.

  3. Endpoint Configuration: Verify the URL in the Search Elasticsearch n8n node. It is currently set to https://localhost:9220/banktransactions/search. Adjust the host, port, and index name (bank_transactions) to match your actual Elasticsearch environment.

  4. Activation: Activate the n8n workflow. The Form Trigger n8n node will provide a unique URL where users can access the dynamic search interface.

  5. Self-Hosting Note: If you are using a self-hosted n8n instance, ensure the Read/Write Files from Disk n8n node has permission to write to the designated /tmp/ location.

Node Details

Search Form (n8n Trigger): Serves as the user interface and entry point. It collects necessary search parameters, including minimum amount, a required time range dropdown, an optional Customer ID field, and the desired Report Format (Text or CSV).
Build Search Query (Code n8n node): Essential for core logic flow control. It uses JavaScript to parse form inputs, dynamically constructs the Elasticsearch JSON query (using bool/must clauses for timestamp range, amount range, and optional customer ID term filter), and converts time ranges (e.g., 'Last 24 Hours') into ES-compatible time notations.
Search Elasticsearch (HTTP Request n8n node): Executes the data search. It sends a POST request containing the dynamic JSON query generated by the previous n8n node to the /banktransactions/search endpoint. It is configured to use HTTP Basic Authentication.
Format Report (Code n8n node): Responsible for data manipulation and output preparation. It iterates over the Elasticsearch results, formats the data into either a human-readable text file or a machine-readable CSV file, and transforms the content into binary data ready for saving. This n8n node also handles filename generation.


  • Read/Write Files from Disk (n8n node): The final action in this n8n workflow. It uses the binary data generated by the Format Report n8n node and saves the resulting report file (e.g., report_YYYY-MM-DD.csv) to a predefined location on the server's file system.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by

Smart Connection Analysis from Open Data, Globally at Scale

Featured*