Looking for Open-Source Models for Text-to-DSL Query Generation in OpenSearch

I’m building a system where users enter a natural language query, and an LLM converts it into an OpenSearch DSL query. My workflow looks like this:

  1. Provide the model with an OpenSearch index schema and 1–2 sample documents.

  2. Pass the user’s natural language query.

  3. Model generates the corresponding DSL.

  4. Validate the DSL in OpenSearch.

  5. Store valid query–DSL pairs for future fine-tuning.

I’m specifically looking for open-source models that:

  • Handle structured JSON output well (e.g., match, bool, filter, sort, aggregations).

  • Are easy to fine-tune with domain-specific DSL patterns.

  • Can run locally for testing but also scale in production.

  • Work well with schema + sample doc prompts.

If you’ve successfully fine-tuned any open-source model for OpenSearch DSL generation

@Arun I think this could fit your needs.

I’m building a similar setup where user prompts should be translated into OpenSearch DSL automatically.

Could anyone share which model(s) worked best for you — especially smaller or offline models