Skip to content

Commit 4b4796d

Browse files
[SIEM][Detection Engine][Lists] Adds "wait_for" to all the create, update, patch, delete endpoints
## Summary * Adds "wait_for" to all the create, update, patch, and delete endpoints * Ran some quick tests against import and the performance still looks acceptable * Updates the unit tests to reflect the addition ### Checklist - [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
1 parent e54729c commit 4b4796d

14 files changed

+17
-0
lines changed

x-pack/plugins/lists/server/services/items/create_list_item.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe('crete_list_item', () => {
3636
body,
3737
id: LIST_ITEM_ID,
3838
index: LIST_ITEM_INDEX,
39+
refresh: 'wait_for',
3940
};
4041
expect(options.callCluster).toBeCalledWith('index', expected);
4142
});

x-pack/plugins/lists/server/services/items/create_list_item.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export const createListItem = async ({
7171
body,
7272
id,
7373
index: listItemIndex,
74+
refresh: 'wait_for',
7475
});
7576

7677
return {

x-pack/plugins/lists/server/services/items/create_list_items_bulk.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ describe('crete_list_item_bulk', () => {
3333
secondRecord,
3434
],
3535
index: LIST_ITEM_INDEX,
36+
refresh: 'wait_for',
3637
});
3738
});
3839

@@ -70,6 +71,7 @@ describe('crete_list_item_bulk', () => {
7071
},
7172
],
7273
index: '.items',
74+
refresh: 'wait_for',
7375
});
7476
});
7577
});

x-pack/plugins/lists/server/services/items/create_list_items_bulk.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const createListItemsBulk = async ({
8484
await callCluster('bulk', {
8585
body,
8686
index: listItemIndex,
87+
refresh: 'wait_for',
8788
});
8889
} catch (error) {
8990
// TODO: Log out the error with return values from the bulk insert into another index or saved object

x-pack/plugins/lists/server/services/items/delete_list_item.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ describe('delete_list_item', () => {
4747
const deleteQuery = {
4848
id: LIST_ITEM_ID,
4949
index: LIST_ITEM_INDEX,
50+
refresh: 'wait_for',
5051
};
5152
expect(options.callCluster).toBeCalledWith('delete', deleteQuery);
5253
});

x-pack/plugins/lists/server/services/items/delete_list_item.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const deleteListItem = async ({
2828
await callCluster('delete', {
2929
id,
3030
index: listItemIndex,
31+
refresh: 'wait_for',
3132
});
3233
}
3334
return listItem;

x-pack/plugins/lists/server/services/items/delete_list_item_by_value.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ describe('delete_list_item_by_value', () => {
5252
},
5353
},
5454
index: '.items',
55+
refresh: 'wait_for',
5556
};
5657
expect(options.callCluster).toBeCalledWith('deleteByQuery', deleteByQuery);
5758
});

x-pack/plugins/lists/server/services/items/delete_list_item_by_value.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const deleteListItemByValue = async ({
4848
},
4949
},
5050
index: listItemIndex,
51+
refresh: 'wait_for',
5152
});
5253
return listItems;
5354
};

x-pack/plugins/lists/server/services/items/update_list_item.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export const updateListItem = async ({
6262
},
6363
id: listItem.id,
6464
index: listItemIndex,
65+
refresh: 'wait_for',
6566
});
6667
return {
6768
created_at: listItem.created_at,

x-pack/plugins/lists/server/services/lists/create_list.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ describe('crete_list', () => {
5252
body,
5353
id: LIST_ID,
5454
index: LIST_INDEX,
55+
refresh: 'wait_for',
5556
};
5657
expect(options.callCluster).toBeCalledWith('index', expected);
5758
});

x-pack/plugins/lists/server/services/lists/create_list.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export const createList = async ({
6767
body,
6868
id,
6969
index: listIndex,
70+
refresh: 'wait_for',
7071
});
7172
return {
7273
id: response._id,

x-pack/plugins/lists/server/services/lists/delete_list.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ describe('delete_list', () => {
4747
const deleteByQuery = {
4848
body: { query: { term: { list_id: LIST_ID } } },
4949
index: LIST_ITEM_INDEX,
50+
refresh: 'wait_for',
5051
};
5152
expect(options.callCluster).toBeCalledWith('deleteByQuery', deleteByQuery);
5253
});
@@ -59,6 +60,7 @@ describe('delete_list', () => {
5960
const deleteQuery = {
6061
id: LIST_ID,
6162
index: LIST_INDEX,
63+
refresh: 'wait_for',
6264
};
6365
expect(options.callCluster).toHaveBeenNthCalledWith(2, 'delete', deleteQuery);
6466
});

x-pack/plugins/lists/server/services/lists/delete_list.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ export const deleteList = async ({
3636
},
3737
},
3838
index: listItemIndex,
39+
refresh: 'wait_for',
3940
});
4041

4142
await callCluster('delete', {
4243
id,
4344
index: listIndex,
45+
refresh: 'wait_for',
4446
});
4547
return list;
4648
}

x-pack/plugins/lists/server/services/lists/update_list.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export const updateList = async ({
5555
body: { doc },
5656
id,
5757
index: listIndex,
58+
refresh: 'wait_for',
5859
});
5960
return {
6061
created_at: list.created_at,

0 commit comments

Comments
 (0)