Skip to content

[BUG] "shape" should not be required in GeoShapeQueryField #2011

Open

Description

@efreeti

What is the bug?

The current opesearch-openapi.yaml contias following definition:

    _common.query_dsl___GeoShapeQueryField:
      type: object
      properties:
        indexed_shape:
          $ref: '#/components/schemas/_common.query_dsl___FieldLookup'
        shape:
          $ref: '#/components/schemas/_common.query_dsl___GeoShape'
        relation:
          $ref: '#/components/schemas/_common___GeoShapeRelation'
      required:
        - shape

This is not correct to require "shape", it's not required in the API - https://docs.opensearch.org/latest/query-dsl/geo-and-xy/geoshape/#using-a-pre-indexed-shape-definition

This makes it impossible to do pre-indexed shape queries right now using query DSL generated classes.

How can one reproduce the bug?

new Query.Builder()
    .geoShape(GeoShapeQuery.Builder()
        .field("some")
        .shape(shape -> shape.indexedShape(i -> i.index("some").id("id").path("path")))
        .build()
    )
    .build();

What is the expected behavior?

I expect it to be possible to do pre-indexed shape queries.

What is your host/environment?

Any

Do you have any screenshots?

N/A

Do you have any additional context?

N/A

Activity

  1. added
    bug
    on Jun 19, 2026
  2. lsh1215 commented on Jun 30, 2026

    @lsh1215
    Contributor

    Hi, I’d like to take a look at this.

    From a quick check, this seems like a real client/model mismatch rather than only a usage question. The OpenSearch geoshape docs show the pre-indexed shape form with indexed_shape and no sibling shape, while the generated GeoShapeQueryField currently treats shape as required.

    I also noticed that this requiredness appears to come from the API spec/schema used for generation, not just from the builder itself. Before opening a PR, I wanted to confirm the preferred contribution path:

    • Is the intended API contract that a geo shape query field can use either shape or indexed_shape?
    • Should this be addressed in the API specification first and then regenerated into opensearch-java, or is a direct change in this repo preferred?

    If this sounds right, I’m happy to work on it.

  3. xluo-aws commented on Jul 4, 2026

    @xluo-aws
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buguntriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions