Skip to content

Conversation

@lizozom
Copy link
Contributor

@lizozom lizozom commented Aug 19, 2020

Summary

During the NP migration, we created a couple of internal types for SearchRequest and SearchResponse, defining them to be any.

This PR

  • Replaces SearchRequest, in the few places it was used, with Record<string, any> (Being the result of searchSource.flatten())
  • Replaces SearchResponse with the type defined in the elasticsearch client library.

I opened a couple of issues for gaps in the Elasticsearch Client types

And for the time being used casting to any to work around those issues.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@lizozom lizozom added Feature:Search Querying infrastructure in Kibana v8.0.0 Team:AppArch v7.10.0 labels Aug 19, 2020
@lizozom lizozom requested a review from a team August 19, 2020 18:01
@lizozom lizozom requested a review from a team as a code owner August 19, 2020 18:01
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@lizozom lizozom added the release_note:skip Skip the PR/issue when compiling release notes label Aug 19, 2020
@lizozom lizozom self-assigned this Aug 19, 2020
Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

The more I think about this, it might be a good idea to keep SearchRequest around since there isn't currently a replacement for it.

If we switch everything to use Record, it will make it much harder to find usages of this type later if we want to change it again. Whereas if we keep SearchRequest around and simply update the typings for it, it'll be much easier to locate in the future.

Copy link
Contributor

@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.

I have to agree with @lukeelmers here... I think the changes to SearchResponse make a lot of sense, but I think we should make changes directly to the TS definition for SearchRequest rather than everywhere SearchRequest is used. In the future, if we keep SearchRequest, it will be much easier to refactor once we actually have a valid type.

@lizozom lizozom requested a review from a team as a code owner August 20, 2020 10:48
Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

Code changes LGTM. The fact that we are still stuck using any in a few places is a bummer, but this is still a worthwhile improvement to the status quo.

Hopefully if we get more detailed typings in the client in the future, we will be able to come back and tighten some of these up.

@lizozom lizozom requested a review from lukasolson August 20, 2020 16:22
Copy link
Member

@kertal kertal 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, KibanaApp CodeOwner review, checked out, tested input control and Discover context, works

Copy link
Contributor

@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.

Code LGTM

@lizozom
Copy link
Contributor Author

lizozom commented Aug 23, 2020

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

merge conflict between base and head

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

async chunks size

id value diff baseline
discover 430.6KB +79.0B 430.6KB

page load bundle size

id value diff baseline
data 1.4MB -278.0B 1.4MB
infra 275.6KB +75.0B 275.6KB
total -203.0B

History

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

@lizozom lizozom merged commit bdb73b5 into elastic:master Aug 23, 2020
lizozom added a commit to lizozom/kibana that referenced this pull request Aug 23, 2020
* improve test stability

* Replace SearchRequest = any with Record<string, any>

* Remove SearchResponse = any from data plugin

* docs

* logs

* Revert "Replace SearchRequest = any with Record<string, any>"

This reverts commit 9914ab5.

* code review

* list control

* null check

* null null null

* Jest fix
# Conflicts:
#	src/plugins/data/public/public.api.md
lizozom added a commit that referenced this pull request Aug 23, 2020
#75726)

* [Search] Cleanup SearchRequest and SearchResponse types (#75471)

* improve test stability

* Replace SearchRequest = any with Record<string, any>

* Remove SearchResponse = any from data plugin

* docs

* logs

* Revert "Replace SearchRequest = any with Record<string, any>"

This reverts commit 9914ab5.

* code review

* list control

* null check

* null null null

* Jest fix
# Conflicts:
#	src/plugins/data/public/public.api.md

* merge
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 v7.10.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants