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

[context view] Use courier when querying the context #11127

Merged

Conversation

weltenwort
Copy link
Member

@weltenwort weltenwort commented Apr 10, 2017

Instead of using a separate code path for querying the anchor and
context documents, the context view actions now use a normal
SearchSource and thereby support scripted fields, source filtering and other
features of a SearchSource without duplicated code.

To facilitate this the SearchSource gained the searchAfter field,
which is turned into a search_after clause on the request.

Additionally, the FetchStrategyForSearch now honors the
timefilter.enabled flag. When this flag is enabled, the index list
will be expanded with respect to the current time interval configured in
the timefilter (previous behaviour). When this flag is disabled, the
timefilter values will be ignored when expanding the index list.

@weltenwort weltenwort added :Discovery WIP Work in progress labels Apr 10, 2017
@weltenwort weltenwort self-assigned this Apr 10, 2017
@weltenwort
Copy link
Member Author

I hoped to gain
Without much pain.
A narrow miss -
Jenkins, test this

@weltenwort weltenwort added review and removed WIP Work in progress labels Apr 11, 2017
@weltenwort weltenwort changed the title (WIP) Refactoring/context courier query [context view] Use courier when querying the context Apr 11, 2017
@weltenwort weltenwort requested review from lukasolson and Bargs April 11, 2017 15:31
@lukasolson lukasolson self-assigned this Apr 11, 2017
Copy link
Contributor

@Bargs Bargs left a comment

Choose a reason for hiding this comment

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

This looks great! left one suggestion that you can take or leave as you see fit. I also noticed reverseQuerySort is no longer used. Not sure if you still have plans for it, or if you'd like to delete it.

const queryParameterActions = Private(QueryParameterActionsProvider);
const queryActions = Private(QueryActionsProvider);

// this is apparently the "canonical" way to disable the time picker
timefilter.enabled = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

huh... that concerning. As you say, this seems to be the way to do it at the moment though.

@@ -16,6 +16,7 @@ export default function FetchStrategyForSearch(Private, Promise, timefilter, kbn
*/
reqsFetchParamsToBody: function (reqsFetchParams) {
const indexToListMapping = {};
const timeBounds = timefilter.enabled ? timefilter.getBounds() : null;
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like there's a getActiveBounds method you could use on the timefilter.


return async function fetchAnchor(indexPattern, uid, sort) {
const searchSource = new SearchSource()
.inherits(false)
Copy link
Member

Choose a reason for hiding this comment

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

I'm trying to figure out what exactly this line accomplishes... Does the SearchSource inherit something else by default?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it takes a while to trace the effect. Ultimately it disables the default inheritance from the rootSearchSource:

SearchSource.prototype.getParent = function (onlyHardLinked) {
const self = this;
if (self._parent === false) return;
if (self._parent) return self._parent;
return onlyHardLinked ? undefined : Private(rootSearchSource).get();
};

This is how the the timefilter values get mixed into the request, which I needed to disable for the context query.

Copy link
Member

@lukasolson lukasolson left a comment

Choose a reason for hiding this comment

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

LGTM! Great improvement.

@weltenwort weltenwort force-pushed the refactoring/context-courier-query branch from ccc60f5 to 69e2a8a Compare April 13, 2017 16:31
@weltenwort
Copy link
Member Author

weltenwort commented Apr 13, 2017

A clojure trace
Blocks my ways
To easter weekend bliss!
Please, jenkins, test this!

@scampi
Copy link
Contributor

scampi commented Apr 13, 2017

@weltenwort looks like jenkins had no ear for your nice poem ;)

@spalger
Copy link
Contributor

spalger commented Apr 14, 2017

jenkins, listen to felix and test this

Instead of using a separate code path for querying the anchor and
context documents, the context view actions now use a normal
`SearchSource` and thereby scripted fields, source filtering and other
features of a `SearchSource` without duplicated code.

To facilitate this the `SearchSource` gained the `searchAfter` field,
which is turned into a `search_after` clause on the request.

Additionally, the `FetchStrategyForSearch` now honors the
`timefilter.enabled` flag. When this flag is enabled, the index list
will be expanded with respect to the current time interval configured in
the `timefilter` (previous behaviour). When this flag is disabled, the
`timefilter` values will be ignored when expanding the index list.
@weltenwort weltenwort force-pushed the refactoring/context-courier-query branch from 69e2a8a to bf8ddb5 Compare April 18, 2017 09:20
@weltenwort weltenwort merged commit 0be7acc into elastic:master Apr 18, 2017
weltenwort added a commit to weltenwort/kibana that referenced this pull request Apr 18, 2017
…1127)

Instead of using a separate code path for querying the anchor and
context documents, the context view actions now use a normal
`SearchSource` and thereby scripted fields, source filtering and other
features of a `SearchSource` without duplicated code.

To facilitate this the `SearchSource` gained the `searchAfter` field,
which is turned into a `search_after` clause on the request.

Additionally, the `FetchStrategyForSearch` now honors the
`timefilter.enabled` flag. When this flag is enabled, the index list
will be expanded with respect to the current time interval configured in
the `timefilter` (previous behaviour). When this flag is disabled, the
`timefilter` values will be ignored when expanding the index list.
weltenwort added a commit that referenced this pull request Apr 18, 2017
Backports PR #11127 with adaptions to 5.x (see below)

* [5.x] [context view] Use courier when querying the context (#11127)

Instead of using a separate code path for querying the anchor and
context documents, the context view actions now use a normal
`SearchSource` and thereby scripted fields, source filtering and other
features of a `SearchSource` without duplicated code.

To facilitate this the `SearchSource` gained the `searchAfter` field,
which is turned into a `search_after` clause on the request.

Additionally, the `FetchStrategyForSearch` now honors the
`timefilter.enabled` flag. When this flag is enabled, the index list
will be expanded with respect to the current time interval configured in
the `timefilter` (previous behaviour). When this flag is disabled, the
`timefilter` values will be ignored when expanding the index list.

* Undo named exports fix until rollout has been backported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants