Get all document between two of them

Hi!
I have a lot of documents, some of them with message: "Logged in" and "Logged out"(not all).
How can i get all documents between last coming documents with message "Logged in" and "Logged out"
For example:

1 Document
2 Message "Logged in"
3 Document
4 Document
5 Message "Loged out"
6 Document
7 Document
I need response that returns me:
2 Message "Logged in"
3 Document
4 Document
5 Message "Logged out"

You will need to manage this yourself, there's nothing in ES that can do this.