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

Import/export saved objects #3573

Merged
merged 6 commits into from
Apr 20, 2015
Merged

Conversation

lukasolson
Copy link
Member

This adds importing and exporting of saved objects. All of the magic can be found on the Settings / Objects page, where you'll find a few new buttons/links.

First, you'll notice a couple of links up top: Export and Import. Export will export all of your objects: searches, visualizations, and dashboards. Import will prompt you to select an export file to import all of the objects from that file.

There is also a new export button in the table of objects below, next to delete. This allows you to select individual objects for export.

Currently, there is no dependency management in how objects are exported or imported. In other words, if you export a dashboard, right now it only exports data related to that specific dashboard, not all of the saved visualizations or searches associated with the dashboard. I'm open to discussion about how this can work, and implementing it if we figure out a good way to do it and people think it is necessary.

Closes #1552.

@lukasolson
Copy link
Member Author

Also, I should really write some tests for this code before we merge it. Just sayin'.

@lukasolson
Copy link
Member Author

Ermmm... and fix merge conflicts. :)

@spalger
Copy link
Contributor

spalger commented Apr 13, 2015

I think this needs a conflict-resolution screen before it can be released. Maybe we can do it as a seperate pull, but I think it should block 4.1 if it's going to be separate.

@spalger
Copy link
Contributor

spalger commented Apr 13, 2015

I'm also fine with this not having any dependency management. It's possible to add, and will help people make more useful exports, but I don't think it's necessary for the feature to be useful.

@spalger
Copy link
Contributor

spalger commented Apr 13, 2015

Current functionality looks good!

@@ -153,6 +140,23 @@ define(function (require) {
});
});

function parseSearchSource(searchSourceJson) {
// if we have a searchSource, set its state based on the searchSourceJSON field
if (self.searchSource) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I realize this is just copy pasted, but can you put an early return here?

@spalger spalger assigned lukasolson and unassigned spalger Apr 13, 2015
@lukasolson lukasolson removed the review label Apr 13, 2015
@lukasolson lukasolson assigned spalger and unassigned lukasolson Apr 14, 2015
@spalger spalger assigned lukasolson and unassigned spalger Apr 15, 2015
};
};

self.import = function (result) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We talked about this in person, but the meaning of this method is a bit confusing. Might be better as a static method or a call to #saveSource.

@lukasolson lukasolson removed the review label Apr 16, 2015
@lukasolson
Copy link
Member Author

@spalger I made some changes for you to review again. Now I'm using mget/bulk APIs for import/export instead of single requests per doc. I'm also popping up a warning about all of the documents that will be overwritten if you continue to import the given set of documents.

@lukasolson lukasolson assigned spalger and unassigned lukasolson Apr 20, 2015

$scope.exportAll = function () {
var objs = $scope.services.map(function (service) {
return service.data.map(_.partialRight(_.extend, {type: service.type}));
Copy link
Contributor

Choose a reason for hiding this comment

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

Took me a minute to see what was going on here and on line 84. Maybe wrap this up like transformHitsToExportBody() or something.

@spalger
Copy link
Contributor

spalger commented Apr 20, 2015

@lukasolson thanks for updating this to warn before doing anything. It works great!

While walking through the code I noticed several style based things that would have made reviewing the code easier. I'll take care of them in another pull request unless you want to. Could you respond to #3573 (comment) though?

spalger added a commit that referenced this pull request Apr 20, 2015
@spalger spalger merged commit 9d79891 into elastic:master Apr 20, 2015
@agonen
Copy link

agonen commented Aug 26, 2015

sorry for poping in this thread .

can i import the exported data using curl command (this use for automate installation / application upgrade .) ?

@lukasolson
Copy link
Member Author

@agonen This is not currently possible, but feel free to open a ticket asking for this enhancement.

@lukasolson lukasolson deleted the import-export branch February 11, 2016 18:23
@escay
Copy link

escay commented Oct 25, 2016

Tickets seem to exist:
#4759
#5431

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.

Import, export and clone saved objects
4 participants