Skip to content

Commit

Permalink
remove score from exports
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Jun 11, 2020
1 parent 99924a1 commit aa3afed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ describe('getSortedObjectsForExport()', () => {
"attributes": Object {},
"id": "1",
"references": Array [],
"score": 1,
"type": "index-pattern",
},
Object {
Expand All @@ -94,7 +93,6 @@ describe('getSortedObjectsForExport()', () => {
"type": "index-pattern",
},
],
"score": 1,
"type": "search",
},
Object {
Expand Down Expand Up @@ -172,7 +170,6 @@ describe('getSortedObjectsForExport()', () => {
"attributes": Object {},
"id": "1",
"references": Array [],
"score": 1,
"type": "index-pattern",
},
Object {
Expand All @@ -185,7 +182,6 @@ describe('getSortedObjectsForExport()', () => {
"type": "index-pattern",
},
],
"score": 1,
"type": "search",
},
]
Expand Down Expand Up @@ -235,7 +231,6 @@ describe('getSortedObjectsForExport()', () => {
"attributes": Object {},
"id": "1",
"references": Array [],
"score": 1,
"type": "index-pattern",
},
Object {
Expand All @@ -248,7 +243,6 @@ describe('getSortedObjectsForExport()', () => {
"type": "index-pattern",
},
],
"score": 1,
"type": "search",
},
Object {
Expand Down Expand Up @@ -326,7 +320,6 @@ describe('getSortedObjectsForExport()', () => {
"attributes": Object {},
"id": "1",
"references": Array [],
"score": 1,
"type": "index-pattern",
},
Object {
Expand All @@ -339,7 +332,6 @@ describe('getSortedObjectsForExport()', () => {
"type": "index-pattern",
},
],
"score": 1,
"type": "search",
},
Object {
Expand Down Expand Up @@ -460,7 +452,6 @@ describe('getSortedObjectsForExport()', () => {
},
"id": "1",
"references": Array [],
"score": 1,
"type": "index-pattern",
},
Object {
Expand All @@ -469,7 +460,6 @@ describe('getSortedObjectsForExport()', () => {
},
"id": "2",
"references": Array [],
"score": 1,
"type": "index-pattern",
},
Object {
Expand All @@ -478,7 +468,6 @@ describe('getSortedObjectsForExport()', () => {
},
"id": "3",
"references": Array [],
"score": 1,
"type": "index-pattern",
},
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ async function fetchObjectsToExport({
}

// sorts server-side by _id, since it's only available in fielddata
return findResponse.saved_objects.sort((a: SavedObject, b: SavedObject) =>
a.id > b.id ? 1 : -1
return (
findResponse.saved_objects
// exclude the find-specific `score` property from the exported objects
.map(({ score, ...obj }) => obj)
.sort((a: SavedObject, b: SavedObject) => (a.id > b.id ? 1 : -1))
);
} else {
throw Boom.badRequest('Either `type` or `objects` are required.');
Expand Down

0 comments on commit aa3afed

Please sign in to comment.