Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Use Kibana data plugin and search strategy #27

Draft
wants to merge 3 commits into
base: fg/types-refactor
Choose a base branch
from

Conversation

inge4pres
Copy link

Summary

This is a draft
Here we introduce the usage of the data plugin.

The plugin can be handy to simplify client/server interaction but it comes with a less-widely-open API.
Instead of the REST methods we are using now, it would use an /internal/bsearch endpoint that I still have to explore.

This PR starts implementing it and has some other refactoring that were needed to work with the plugin, such as using shared types between client and server.

I'd like to get a feedback from you about the ergonomics and the possible limitations (still working on implementing the search strategy client-side, working on it atm).

@inge4pres inge4pres added the help wanted Extra attention is needed label Mar 2, 2022
@inge4pres inge4pres self-assigned this Mar 2, 2022
@inge4pres inge4pres changed the title Fg/use data plugin Use Kibana data plugin and search strategy Mar 2, 2022
Signed-off-by: inge4pres <francesco.gualazzi@elastic.co>
Signed-off-by: inge4pres <francesco.gualazzi@elastic.co>
Signed-off-by: inge4pres <francesco.gualazzi@elastic.co>
@inge4pres inge4pres changed the base branch from main to fg/types-refactor March 4, 2022 18:53
@inge4pres
Copy link
Author

@jbcrail @rockdaboot I just updated the PR as we discussed earlier.
I'll check again how to make the UI work with the data plugin in this PR and then we can measure the differences in terms of ergonomic and data trasnferred with the clients.

es.search(
{
params: {
index: downsampledIndex + initialExp,
Copy link
Member

Choose a reason for hiding this comment

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

downsampleIndex sounds as if it holds an index name, which is not true - it only holds the prefix. To help understanding the code, I suggest using a function getDownsampledIndex(initialExp).

const initialExp = 6;
const targetSampleSize = 20000; // minimum number of samples to get statistically sound results

// Calculate the right down-sampled index to query data from
Copy link
Member

Choose a reason for hiding this comment

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

This comment is wrong, describes not what the function does.

});
return sampleCount;
};
return {
Copy link
Member

Choose a reason for hiding this comment

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

Please add an empty line before the return.

},
},
} as IEsSearchRequest;
return es.search(downsampledReq, 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.

Please add an empty line before the return.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants