Hi,
I want to keep a max of 1000 latest documents (notifications) for each user. In case the search finds much more than that, I am trying to use "delete by query" to delete excess documents for the user.
The docs for "delete by query" say that there is a from
option:
(Optional, integer) Starting document offset. Defaults to
0
.
Apparently this is a new feature, as I couldn't find anything related to this option in version 6.8.
I am using elasticsearch PHP client deleteByQuery()
method with the following params:
{
"index": "user_notification",
"from": 1000,
"body": {
"query": {
"term": {
"receiver_id": 77
}
},
"sort": [
{
"timestamp": {
"order": "desc"
}
}
]
}
}
and elasticsearch status 400 with an error message:
Validation Failed:
1: using [from] is not allowed in a scroll context;
2: from is not supported in this context;
What am I doing wrong?
thanks!