opensearch-project / opensearch-project/opensearch-java

[FEATURE] Add support for Derived Fields

Open
#1,766 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
165
Forks
250
Avg merge
1d 18h
Merged PRs (30d)
26

Description

OpenSearch 2.15 introduced derived field types, but the opensearch-java client doesn't yet provide a way to use this feature.

Currently, both the SearchRequest and TypeMapping classes lack methods for setting derived fields. This creates an API mismatch where functionality available in the OpenSearch server isn't accessible through the official Java client.

It would be beneficial to have type-safe methods for working with derived fields in the Java client. Specifically:

  • Methods to define derived fields in index mappings via TypeMapping
  • Methods to set derived fields in search requests via SearchRequest
  • Proper support in the client that matches the server's capabilities for derived fields

This would improve the developer experience and provide better consistency between the server and client APIs.

In earlier versions of the client, the runtimeMappings() method was available for similar functionality, but this approach doesn't work with derived fields and results in errors. Without any dedicated API for derived fields, the only working alternative is to use low-level JSON queries instead of the type-safe Java client API, which isn't ideal for maintainability.

See also: Forum discussion about this topic

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated SearchRequest and TypeMapping classes named in the issue, then read the OpenSearch derived field documentation and the linked forum discussion. Add type-safe support for defining derived fields in mappings and search requests, and verify that both client APIs match the server capability without relying on low-level JSON queries.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.