opensearch-project / opensearch-project/opensearch-java

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

Open Beginner friendly
#2,011 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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

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 opesearch-openapi.yaml and the GeoShapeQuery generated classes used by the Java reproduction. Check how the GeoShapeQueryField schema's required fields become builder validation, then verify that a pre-indexed shape query can be built and serialized without requiring shape.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.