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

Refactor, deangularize courier/search source #45235

Merged
merged 38 commits into from
Oct 18, 2019

Conversation

lukasolson
Copy link
Member

@lukasolson lukasolson commented Sep 10, 2019

Summary

This PR prepares search source for migration to the new platform and to the new search APIs.

Resolves #44659.
Resolves #44738.

Removal of search request

The SearchRequest module added a lot of complications to the way requests were processed, and included behavior that was never used (like lifecycle events and continueIncomplete). It was a confusing construct that had two different promises that might resolve at any given point but really just represented a success or a failure. This PR removes the SearchRequest class (in addition to RequestStatus and IsRequest) and instead passes the actual Elasticsearch request DSL object directly to the search strategy.

Removal of search request queue

This was really just an array, and was only helpful when courier was destroyed so all current requests could be aborted. Now it's the responsibility of the caller of fetch to abort the request. The array of requests to process can now be found in fetchSoon.

Allow passing abortSignal to searchSource.fetch

This PR removes the previous way for a search source to abort an in-progress request, cancelQueued, in favor of passing an abortSignal to the fetch method. This allows the caller of fetch to more easily control when a request should be aborted, and is in line with how we handle aborting other things (like the interpreter and ES cluster client).

Refactoring of callClient

The callClient module used to do things in a very funky way. It would conditionally respond to requests with either a response, or an ABORTED constant. This caused a lot of conditional handling or requests/responses. Now, instead of responding with disparate values, it will either resolve with the response or reject with an error, which in the case of an aborted request, is an AbortError.

For testers

This PR affects the querying of Elasticsearch in many places that should be tested:

  • Discover
    • View surrounding documents
    • View single document
  • Visualize
  • Dashboard
    • Saved visualizations
    • Saved searches
  • Maps
  • Rollups

It's also important to test these areas in conjunction with other things that affect the Elasticsearch query, like KQL/Lucene, filters, and time ranges (including auto-refresh intervals).

It also affects the creation of new index patterns, which should also be tested.

Checklist

For maintainers

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch


await respondToSearchRequests(responsesInOriginalRequestOrder);
} catch(error) {
if (errorAllowExplicitIndex.test(error)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Right now if you set rest.action.multi.allow_explicit_index to false in your elasticsearch.yml, a lot of things are broken (including the saved objects client and add sample data). I don't see any reason to explicitly handle this here because the apps also rely on the saved objects client, which doesn't handle this. Maybe we should open an issue to better handle this scenario from a higher level.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@lukasolson lukasolson changed the title [WIP] Refactor, deangularize, typescriptify, jestify, NP-readify courier/search source [skip ci] [WIP] Refactor, deangularize, typescriptify, jestify, NP-readify courier/search source Sep 10, 2019
@lukasolson lukasolson changed the title [skip ci] [WIP] Refactor, deangularize, typescriptify, jestify, NP-readify courier/search source [skip ci] [WIP] Refactor, deangularize courier/search source Sep 16, 2019
@lukasolson lukasolson changed the title [skip ci] [WIP] Refactor, deangularize courier/search source Refactor, deangularize courier/search source Sep 24, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@lukasolson lukasolson added v7.6.0 and removed v7.5.0 labels Oct 15, 2019
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

code LGTM

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Search Querying infrastructure in Kibana release_note:skip Skip the PR/issue when compiling release notes review v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Navigating to/from Discover with applied filters throws AbortError Deangularize courier/search source
5 participants