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

Create a class to hold field capabilities for one index. #51721

Merged
merged 6 commits into from
Feb 4, 2020

Conversation

jtibshirani
Copy link
Contributor

@jtibshirani jtibshirani commented Jan 31, 2020

Currently, the same class FieldCapabilities is used both to represent the
capabilities for one index, and also the merged capabilities across indices. To
help clarify the logic, this PR proposes to create a separate class
IndexFieldCapabilities for the capabilities in one index. The refactor will
also help when adding source_path information in #49264, since the merged
source path field will have a different structure from the field for a single index.

Individual changes:

  • Add a new class IndexFieldCapabilities.
  • Remove extra constructor from FieldCapabilities.
  • Combine the add and merge methods in FieldCapabilities.Builder.

@jtibshirani jtibshirani added :Search Foundations/Mapping Index mappings, including merging and defining field types >refactoring labels Jan 31, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Mapping)

@jtibshirani jtibshirani marked this pull request as ready for review January 31, 2020 07:23
in.readOptionalStringArray();
}

if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The serialization turned out to be a bit messy unfortunately.

@jtibshirani jtibshirani added the WIP label Feb 3, 2020
Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change makes sense to me, the bwc path is a bit difficult to read (we serialize IndexFieldCapabilities as FieldCapabilities for nodes < 8) but I don't have a better idea to simplify.

@jtibshirani
Copy link
Contributor Author

Thanks @jimczi for the review.

(we serialize IndexFieldCapabilities as FieldCapabilities for nodes < 8)

I pushed a change to the serialization logic to make this clearer, I'm curious if you find it better.

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks better to me, thanks @jtibshirani

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>refactoring :Search Foundations/Mapping Index mappings, including merging and defining field types v7.7.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants