Skip to content

Introduce eql search status API #68065

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

Merged

Conversation

mayya-sharipova
Copy link
Contributor

@mayya-sharipova mayya-sharipova commented Jan 27, 2021

Introduce eql search status API,
that reports the status of eql stored or async search.

GET _eql/search/status/

The API is restricted to the monitoring_user role.

For a running eql search, a response has the following format:

{
  "id" : <id>,
  "is_running" : true,
  "is_partial" : true,
  "start_time_in_millis" : 1611690235000,
  "expiration_time_in_millis" : 1611690295000
}

For a completed eql search, a response has the following format:

{
  "id" : <id>,
  "is_running" : false,
  "is_partial" : false,
  "expiration_time_in_millis" : 1611690295000,
  "completion_status" : 200
}

Closes #66955

Introduce eql search status API,
that reports the status of eql stored or async search.

GET _eql/search/status/<id>

The API is restricted to the monitoring_user role.

For a running eql search, a response has the following format:

{
  "id" : <id>,
  "is_running" : true,
  "is_partial" : true,
  "start_time_in_millis" : 1611690235000,
  "expiration_time_in_millis" : 1611690295000
}

For a completed eql search, a response has the following format:

{
  "id" : <id>,
  "is_running" : false,
  "is_partial" : false,
  "expiration_time_in_millis" : 1611690295000,
  "completion_status" : 200
}

Closes elastic#66955
@mayya-sharipova mayya-sharipova added the :Search/Search Search-related issues that do not fall into other categories label Jan 27, 2021
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Jan 27, 2021
@elasticmachine
Copy link
Collaborator

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

@mayya-sharipova mayya-sharipova added the :Analytics/EQL EQL querying label Jan 27, 2021
@elasticmachine elasticmachine added the Team:QL (Deprecated) Meta label for query languages team label Jan 27, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-ql (Team:QL)

@mayya-sharipova
Copy link
Contributor Author

@lizozom Unfortunately for eql searches, we could not the same response format as for async searches, as we don't store shards progress for eql searches. I hope the format presented above works for you.

Copy link
Contributor

@imotov imotov left a comment

Choose a reason for hiding this comment

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

Looks good to me in general. Left a couple of comments. I think it would be great if @costin could also take a look.

/**
* An interface for status response of the stored or running async search
*/
public interface SearchStatusResponse {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is quite a bit of code repetition between AsyncStatusResponse and EqlStatusResponse, and between TransportEqlAsyncGetStatusAction and TransportGetAsyncStatusAction, any reason for not moving more shared things into SearchStatusResponse and AsyncTaskIndexService respectively?

Copy link
Contributor Author

@mayya-sharipova mayya-sharipova Feb 3, 2021

Choose a reason for hiding this comment

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

@imotov Thank for the feedback, addressed in 4321efb. Can you please continue with the review when you have time.

I was not able to combine AsyncStatusResponse and EqlStatusResponse together because it would complicate the wire serialization/deserialization code. As we already have AsyncStatusResponse form 7.11, I did not want to change that part of the code.

@mayya-sharipova
Copy link
Contributor Author

@imotov @astefan Thanks for reviewing the PR. I will study and address your comments.
One questions I have is that the Kibana team is interested to show the progress of EQL async search task, but it looks like currently EQL doesn't store partial results. Is there a plan to store partial results in a similar way how async search stores them?

@costin
Copy link
Member

costin commented Feb 1, 2021

LGTM to me from my end though I'm not familiar with the async code so I'm non-binding :)
Regarding the EQL results, and this should be a separate PR, how can the partial information be exposed? The completed sequences (or in case of events query searches) are kept based on their doc ids and their sources retrieved at the end (see

).
However it should be trivial to signal a new match during the process.

@mayya-sharipova
Copy link
Contributor Author

@costin Thank you for checking.

Regarding the EQL results, and this should be a separate PR, how can the partial information be exposed?

For a partial information for a status report, we don't need partial results, Kibana just needs progress indication about the number of the completed shards so far and total shards.
But overall, I was wondering if the EQL team has plans to store partial results or is that something that doesn't make sense for EQL and is not planned?

@mark-vieira
Copy link
Contributor

@elasticmachine update branch

- Add serializing tests for EqlStatusResponse and AsyncStatusResponse
- Move shared code of TransportEqlAsyncGetStatusAction and
  and TransportGetAsyncStatusAction to AsyncTaskIndexService
- Use clusterService.state().getNodes().getLocalNode()
  to get a local node
Also remove skip section in yml tests, as these tests
are not used for BWC testings
Copy link
Contributor

@imotov imotov 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 modifications! Left a small comment about a potential race condition in the integration test. Otherwise LGTM.

Comment on lines 180 to 181
- match: { is_running: true }
- match: { is_partial: true }
Copy link
Contributor

Choose a reason for hiding this comment

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

These two checks will probably fail occasionally due to a race condition with task completion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@imotov Thanks! Good feedback! Indeed, we are not certain if the task is completed or not by this time! I changed the test in 4eca9a0 to test for less.

@mayya-sharipova mayya-sharipova merged commit 6521d2a into elastic:master Feb 11, 2021
@mayya-sharipova mayya-sharipova deleted the eql-async-search-status branch February 11, 2021 14:30
mayya-sharipova added a commit that referenced this pull request Feb 11, 2021
Introduce eql search status API,
that reports the status of eql stored or async search.

GET _eql/search/status/<id>

The API is restricted to the monitoring_user role.

For a running eql search, a response has the following format:

{
  "id" : <id>,
  "is_running" : true,
  "is_partial" : true,
  "start_time_in_millis" : 1611690235000,
  "expiration_time_in_millis" : 1611690295000
}

For a completed eql search, a response has the following format:

{
  "id" : <id>,
  "is_running" : false,
  "is_partial" : false,
  "expiration_time_in_millis" : 1611690295000,
  "completion_status" : 200
}

Backport for #68065
Closes #66955
pgomulka added a commit that referenced this pull request Feb 15, 2021
A commit from #68065 missed a parameter description
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request Feb 15, 2021
A commit from elastic#68065 missed a parameter description
pgomulka added a commit that referenced this pull request Feb 15, 2021
A commit from #68065 missed a parameter description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/EQL EQL querying >enhancement :Search/Search Search-related issues that do not fall into other categories Team:QL (Deprecated) Meta label for query languages team Team:Search Meta label for search team v7.12.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EQL _async_search status API
8 participants