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

[data.search] Add extend functionality to server-side search service #86195

Merged
merged 15 commits into from
Jan 5, 2021

Conversation

lukasolson
Copy link
Member

Summary

Adds a third method, extend to search strategies. The purpose of this method is to extend the TTL of the given search ID by the given duration (or keep_alive).

Checklist

For maintainers

@lukasolson lukasolson added Feature:Search Querying infrastructure in Kibana v8.0.0 Team:AppServices release_note:skip Skip the PR/issue when compiling release notes Project:AsyncSearch Background search, partial results, async search services. v7.12.0 labels Dec 16, 2020
@lukasolson lukasolson self-assigned this Dec 16, 2020
@lukasolson lukasolson requested a review from a team as a code owner December 16, 2020 21:38
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

@lukasolson
Copy link
Member Author

@elasticmachine merge upstream

if (!strategy.extend) {
throw new Error(`Search strategy ${options.strategy} does not support extend`);
}
return strategy.extend(id, keepAlive, options, deps);
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts about validating the keepAlive string? It looks like it should be a valid time units string: https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units

Copy link
Member Author

Choose a reason for hiding this comment

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

After giving this some thought, I think we can rely on the error/message we get back from Elasticsearch for this:

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "failed to parse setting [keep_alive] with value [foobar] as a time value: unit is missing or unrecognized"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "failed to parse setting [keep_alive] with value [foobar] as a time value: unit is missing or unrecognized"
    },
    "status": 400
}

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

The code LGTM but I'm not sure how to test the changes

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

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

Cound you also add an api integration test for this API?

test/api_integration/apis/search/search.ts

src/plugins/data/server/search/search_service.ts Outdated Show resolved Hide resolved
@lukasolson
Copy link
Member Author

Cound you also add an api integration test for this API?

This PR doesn't add any endpoints to access the extend functionality, since this extend method really only extends an individual search request (which we won't be allowing end users to do via an endpoint). When we add the method on the session service, we will add an endpoint and I can add the API integration test.

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

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

LGTM

@lukasolson lukasolson merged commit a2b4517 into elastic:master Jan 5, 2021
lukasolson added a commit to lukasolson/kibana that referenced this pull request Jan 5, 2021
…service (elastic#86195)

* [data.search.session] Store search strategy in saved object

* [data.search.session] Add extend functionality

* Update docs

* Update unit test to check strategy

* Throw kbnServerError instead of error

* Fix test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@lukasolson lukasolson changed the title [data.search.session] Add extend functionality to server-side search service [data.search] Add extend functionality to server-side search service Jan 5, 2021
lukasolson added a commit that referenced this pull request Jan 5, 2021
…service (#86195) (#87320)

* [data.search.session] Store search strategy in saved object

* [data.search.session] Add extend functionality

* Update docs

* Update unit test to check strategy

* Throw kbnServerError instead of error

* Fix test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Distributable file count

id before after diff
default 47252 48012 +760

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

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 Project:AsyncSearch Background search, partial results, async search services. release_note:skip Skip the PR/issue when compiling release notes v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants