title: Kibana - get logs surrounding certain document with patterns to mark start and end range of a context
body: <p>For example, I see an error log in Kibana, but I am not interested only in this error, but also the context of this line, i.e., I want to know what happens before and after this error. Such as:</p>
  <ul>
  <li>the order failed with status &quot;FAILED&quot;, but the log just before this line would contain the method name who caused this error</li>
  <li>some 5-10 lines before this, I know there would be a line like &quot;Start processing order xxxxx with status xxx&quot;</li>
  <li>and 15-20 lines after this log, there would be something like &quot;End processing with status xxx&quot;</li>
  </ul>
  <p>All this together, marks a life cycle of processing of this particular order. And all these lines are what I mean by saying &quot;context&quot;.</p>
  <p>How can I get all these lines as a search in Kibana?(Let's suppose all the literals are in the field &quot;message&quot;)</p>
  <p>For now, I know we can &quot;view surrounding documents&quot;, but that is not efficient enough.</p>