kth.sePublications KTH
Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
PReFoRCE-ES: Natural Language to Elasticsearch: An Agent Specialized for ES Query Generation in a Complex Business Context
KTH, School of Engineering Sciences in Chemistry, Biotechnology and Health (CBH), Biomedical Engineering and Health Systems, Health Informatics and Logistics.
KTH, School of Engineering Sciences in Chemistry, Biotechnology and Health (CBH), Biomedical Engineering and Health Systems, Health Informatics and Logistics.
2026 (English)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE creditsStudent thesisAlternative title
PReFoRCE-ES: Naturligt språk till Elasticsearch : En agent specialiserad för Query-generering i ett komplext affärskontext (Swedish)
Abstract [en]

Enabling non-technical users to query large-scale databases using natural language is a growing challenge in the field of data analysis. This study addresses the problem of generating correctly executable code for the Elasticsearch database, where standard language models often fail due to complex data structures. The proposed solution is PReFoRCE-ES, an iterative agentic architecture developed using LangChain4j which is a Java framework. This is an adapted version of ReFoRCE for non-relational databases that use context compression, self-refinement and consensus enforcement to validate generated queries prior to execution. The Agent was evaluated on a dataset within the telecommunications domain and benchmarked against a baseline GPT-4o. Results demonstrate that the agent outperforms the baseline on complex reasoning tasks, achieving an Execution Accuracy of 52.5% on reasoning queries and 80% on standard retrieval tasks, compared to the baseline’s 0% .The study concludes that agentic workflows are necessary for ensuring reliability in complex logical operations, though this comes at the expense of increased latency.

Place, publisher, year, edition, pages
2026.
Series
TRITA-CBH-GRU ; 2026:027
Keywords [en]
Elasticsearch, Large Language Models, Generative AI, Agentic workflows, RAG, LangChain4j, Prompt-technique, BGE-M3
Keywords [sv]
Elasticsearch, Stora språkmodeller, Generativ AI, Agent-system, RAG, LangChain4j, Prompt-teknik, BGE-M3
National Category
Artificial Intelligence
Identifiers
URN: urn:nbn:se:kth:diva-376823OAI: oai:DiVA.org:kth-376823DiVA, id: diva2:2039530
External cooperation
Giesecke+Devrient
Subject / course
Computer Technology, Program- and System Development
Educational program
Bachelor of Science in Engineering - Engineering and Economics
Supervisors
Examiners
Available from: 2026-02-20 Created: 2026-02-17 Last updated: 2026-02-20Bibliographically approved

Open Access in DiVA

PReFoRCE-ES: Natural Language to Elasticsearch(982 kB)312 downloads
File information
File name FULLTEXT01.pdfFile size 982 kBChecksum SHA-512
7641d2df58c759fd6e528aa4be71d5ce50d549e470d6e08020d569e742660fff23ec5266a50bef3d90bec830e30a26da51a89174b3daead048e4163789eb651d
Type fulltextMimetype application/pdf

By organisation
Health Informatics and Logistics
Artificial Intelligence

Search outside of DiVA

GoogleGoogle Scholar
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 7394 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf