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

Extra testing and some cleanups for filtering on field caps #85068

Merged
merged 19 commits into from
Mar 29, 2022

Conversation

romseygeek
Copy link
Contributor

@romseygeek romseygeek commented Mar 17, 2022

  • adds a test for mixed cluster requests
  • fixes a bad stream version check (above test will fail if this isn't included)
  • replaces private FieldCapsFilter interface with Predicate
  • renames 'allowedTypes' to 'types' to maintain consistency with external API
  • adds javadoc to ResponseRewriter
  • removes isRuntimeField from FieldTypeLookup

Relates to #83636

@romseygeek romseygeek added :Search Foundations/Mapping Index mappings, including merging and defining field types >tech debt v8.2.0 labels Mar 17, 2022
@romseygeek romseygeek requested a review from javanna March 17, 2022 15:48
@romseygeek romseygeek self-assigned this Mar 17, 2022
@elasticsearchmachine
Copy link
Collaborator

Hi @romseygeek, I've created a changelog YAML for you.

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Mar 17, 2022
@romseygeek
Copy link
Contributor Author

So the test is failing because the rest client picks a random host to hit with its request, and we in fact need it to pick the upgraded host so that the new parameters are recognised by the co-ordinating node.

@sethmlarson sethmlarson added the Team:Clients Meta label for clients team label Mar 21, 2022
Copy link
Member

@javanna javanna left a comment

Choose a reason for hiding this comment

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

I left a few comments, thanks for working on this.

Do we still need to expand the serialization unit tests or was that covered in the meantime? Do you plan on opening another PR for the docs improvements?


@SuppressWarnings("unchecked")
private RestClient getUpgradedNodeClient() throws IOException {
for (HttpHost host : getClusterHosts()) {
Copy link
Member

Choose a reason for hiding this comment

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

you can plug in a NodeSelector to the RestClient to have it only point to nodes with specific characteristics. Version can be a factor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Frustratingly that doesn't help here, because the RestClientBuilder doesn't know the version of its Nodes up-front, and so we can't get the version in the NodeSelector.

Copy link
Member

Choose a reason for hiding this comment

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

ok for my understanding, maybe the problem is that the existing client does not point to the upgraded nodes? I guess it depends on how it is initialized. The point of node selector is to influence node selection when making each request, but then all nodes need to be added to the client rotation. I see that the client gets the nodes from tests.rest.cluster set on build.gradle. Is there a chance that not all nodes are included?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the nodes are included; the problem is that the RestClientBuilder.builder(HttpHost hosts...) that gets called here then builds its Nodes using plain Node::new, which doesn't set any Node metadata (including the version).

Copy link
Member

Choose a reason for hiding this comment

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

got it. Only the sniffer sets these automatically as it has knowledge about the metadata, but you can set metadata up yourself by using the builder(Node ... nodes) method. That makes this change not so useful and along the lines of what you already have though. Have a look if it makes sense to make the change or not?

@romseygeek
Copy link
Contributor Author

Do we still need to expand the serialization unit tests or was that covered in the meantime? Do you plan on opening another PR for the docs improvements?

Serialization should be covered by the rolling upgrade IT test. I've expanded on the docs a little in the latest update.

Copy link
Member

@javanna javanna left a comment

Choose a reason for hiding this comment

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

Can we add setting and handling the additional fields in FieldCapabilitiesRequestTests as well as FieldCapabilitiesNodeRequestTests? LGTM besides that, no need for another round.

@romseygeek romseygeek merged commit a545260 into elastic:master Mar 29, 2022
@romseygeek
Copy link
Contributor Author

Thanks for the reviews @javanna!

@romseygeek romseygeek deleted the fieldcaps/filtering-followups branch March 29, 2022 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Clients Meta label for clients team Team:Search Meta label for search team v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants