Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redundant collapse in FieldCollapse type #2489

Open
buinauskas opened this issue Apr 8, 2024 · 0 comments
Open

Redundant collapse in FieldCollapse type #2489

buinauskas opened this issue Apr 8, 2024 · 0 comments

Comments

@buinauskas
Copy link

🐛 Wrong type

FieldCollapse has second-level collapse defined at the root level, which is not valid

According to spec, such query should work but it won't:

{
    "collapse": {
        "field": "country_id",
        "collapse": {
            "field": "category_id"
        }
    }
}

Results in the following response from /_search api:

{
    "error": {
        "root_cause": [
            {
                "type": "x_content_parse_exception",
                "reason": "[4:9] [collapse] unknown field [collapse]"
            }
        ],
        "type": "x_content_parse_exception",
        "reason": "[4:9] [collapse] unknown field [collapse]"
    },
    "status": 400
}

The second level collapse can be defined inside inner hits only with the field property but not at the FieldCollapse object itself.

Definition

I believe this could be enough

export class FieldCollapse {
  /**
   * The field to collapse the result set on
   */
  field: Field
  /**
   * The number of inner hits and their sort order
   */
  inner_hits?: InnerHits | InnerHits[]
  /**
   * The number of concurrent requests allowed to retrieve the inner_hits per group
   */
  max_concurrent_group_searches?: integer
-  collapse?: FieldCollapse
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant