I have a lot of log messages in one ElasticSearch index.
These log messages containing two special messages. One start message and one end message (simply having a field with the value 'START' and 'STOP').
Can I create a query in ElasticSearch that returns all logs in that index between these two messages?
Here an example that shows simplified how my data look like:
PUT log
{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
}
},
"mappings": {
"_doc": {
"properties": {
"timestamp": {
"type": "date",
"format": "epoch_millis"
},
"msg": {
"type": "text"
}
}
}
}
}
PUT log/_doc/1
{
"timestamp": 1000,
"msg" : "TO_EARLY"
}
PUT log/_doc/2
{
"timestamp": 2000,
"msg" : "START"
}
PUT log/_doc/3
{
"timestamp": 3000,
"msg" : "Hello, World!"
}
PUT log/_doc/4
{
"timestamp": 4000,
"msg" : "STOP"
}
PUT log/_doc/5
{
"timestamp": 5000,
"msg" : "TO_LATE"
}
So my question is: How does the query looks like to get the message between the START and the STOP message?
Thanks for your help.
Raphael