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

[Index patterns] Default index pattern REST API #100691

Merged
merged 4 commits into from
May 27, 2021

Conversation

Dosant
Copy link
Contributor

@Dosant Dosant commented May 26, 2021

Summary

close #97337

Adds new routes for index patterns REST API.

I just mimicked the API of the existing index pattern service to keep things simpler.

Get the id of the default index pattern

GET /api/index_patterns/default

returns index pattern id or null

{
  "index_pattern_id": "..."
}

Set default index pattern by id if no currently set

POST /api/index_patterns/default 
{
  "index_pattern_id": "<id>" 
}

Force default index pattern id using force modifier

POST /api/index_patterns/default 
{
  "index_pattern_id": "<id>",
  "force": true 
}

returns

{
 "acknowledged": true
}

Please note: there is no validation that supplied index pattern id exists. This is done to give more flexibility when using the API.

Thoughts

@mattkime, Index pattern REST API uses IndexPatternsService which is a common service reused between client and server. Should we consider refactoring this in the future, so that the client-side service starts using REST API internally instead of saved object client directly?

Checklist

For maintainers

Release Notes

Expose default index pattern management in index patterns REST API

@Dosant Dosant added Feature:Data Views Data Views code and UI - index patterns before 8.0 Team:AppServices v7.14.0 v8.0.0 release_note:feature Makes this part of the condensed release notes labels May 26, 2021
@Dosant Dosant marked this pull request as ready for review May 26, 2021 16:32
@Dosant Dosant requested a review from a team as a code owner May 26, 2021 16:32
@elasticmachine
Copy link
Contributor

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

@Dosant Dosant requested a review from mattkime May 26, 2021 16:32
@mattkime
Copy link
Contributor

Should we consider refactoring this in the future, so that the client-side service starts using REST API internally instead of saved object client directly?

I'm not certain if there are clear advantages of doing this, perhaps you're aware of some. My first thoughts are we'd want to make sure we preserve type safety.

Copy link
Contributor

@mattkime mattkime left a comment

Choose a reason for hiding this comment

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

I think this still needs docs similar to https://github.com/elastic/kibana/pull/100549/files

@Dosant
Copy link
Contributor Author

Dosant commented May 27, 2021

I think this still needs docs similar to https://github.com/elastic/kibana/pull/100549/files

👍 When I opened this one the docs pr hasn't been merged yet. Now since it has been merged I updated docs!

I'm not certain if there are clear advantages of doing this, perhaps you're aware of some. My first thoughts are we'd want to make sure we preserve type safety.

One practical benefit is that we would potentially reduce places where we have sequential networks calls from browser

@Dosant Dosant requested a review from mattkime May 27, 2021 09:08
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 817.5KB 817.7KB +178.0B
Unknown metric groups

API count

id before after diff
data 3764 3768 +4

References to deprecated APIs

id before after diff
canvas 29 25 -4
crossClusterReplication 8 6 -2
fleet 22 20 -2
globalSearch 4 2 -2
indexManagement 12 7 -5
infra 261 149 -112
lens 67 45 -22
licensing 18 15 -3
lists 239 236 -3
maps 286 208 -78
ml 121 115 -6
monitoring 109 56 -53
securitySolution 386 342 -44
stackAlerts 101 95 -6
total -342

History

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

Copy link
Contributor

@mattkime mattkime 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Data Views Data Views code and UI - index patterns before 8.0 release_note:feature Makes this part of the condensed release notes v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kibana API for selecting default pattern
4 participants