DualES: Internalizing Query-Text Duality for Text-to-ES via Bidirectional Reasoning-Enhanced Supervision
Abstract
AbstractText-to-ES aims to translate natural language into executable Elasticsearch(ES) queries. Unlike more open-ended reasoning tasks, such as mathematical reasoning, this problem is defined over a constrained domain-specific language, where the synergy between forward reasoning and backward reasoning can be more explicitly realized under strict structural constraints. While recent work has explored reasoning-oriented training and prompting in text-to-SQL, forward and backward reasoning have not been systematically studied in text-to-ES. In this paper, we systematically study the bidirectional duality of the text-to-ES task by establishing a bidirectional reasoning perspective across both training and prompting stages. We introduce two large-scale datasets, TERD and ETRD, for forward and backward reasoning, respectively, and propose DualES, a unified framework that combines the two. Experimental results show that our DualES-CoRE strategy sets a new State-of-the-Art(SOTA), achieving 69.23% on LED and 50.14% on BirdES. This corresponds to absolute execution accuracy gains of 6.92% and 7.34% over previous benchmarks, outperforming both open-source and closed-source baselines. We will release the datasets in the future.