Skip to content

Add a Multi-Project Search Rest Test #128657

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tvernum
Copy link
Contributor

@tvernum tvernum commented May 30, 2025

This commit adds a Rest IT specifically for search in MultiProject. Everything was already working as expected, but we were a bit light on explicit testing for search, which as the core capability of Elasticsearch is worth testing thoroughly and clearly.

Relates: ES-9352

This commit adds a Rest IT specifically for search in MultiProject.
Everything was already working as expected, but we were a bit light on
explicit testing for search, which as _the_ core capability of
Elasticsearch is worth testing thoroughly and clearly.
@tvernum tvernum requested a review from a team May 30, 2025 08:28
@tvernum tvernum added >test Issues or PRs that are addressing/adding tests :Search/Search Search-related issues that do not fall into other categories v9.1.0 labels May 30, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label May 30, 2025
Copy link
Contributor

@benchaplin benchaplin left a comment

Choose a reason for hiding this comment

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

Thanks for the nice tests! Helpers make it super easy to read :).

"query": { "term": { "project": 1 } }
}
""";
results1 = getHitIds(search(projectId1, indexPrefix + "-*", query));
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: maybe we should move getHitIds into search(ProjectId projectId, String indexExpression, String body) so we don't need to call it here?

results2 = search(projectId2, indexName);
assertThat(results2, containsInAnyOrder(docId2a, docId2b));

results1 = search(projectId1, indexPrefix + "-*");
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious - what's being tested with this final search?

// That is, an aggregation with size:0
ObjectPath response = search(projectId1, indexName, query);
String context = "In search response: " + response;
assertThat(response.evaluateArraySize("aggregations.proj.buckets"), equalTo(1));
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean to add context to these assertions :)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team >test Issues or PRs that are addressing/adding tests v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants