“必须匹配”我在日志下面,我想用ElasticSearch查询发现:在elasticsearchElasticsearch查询日志
2014-07-02 20:52:39 INFO home.helloworld: LOGGER/LOG:ID1234 has successfully been received, {"uuid"="abc123"}
2014-07-02 20:52:39 INFO home.helloworld: LOGGER/LOG:ID1234 has successfully been transferred, {"uuid"="abc123"}
2014-07-02 20:52:39 INFO home.byebyeworld: LOGGER/LOG:ID1234 has successfully been processed, {"uuid"="abc123"}
2014-07-02 20:52:39 INFO home.byebyeworld: LOGGER/LOG:ID1234 has exited, {"uuid"="abc123"}
2014-07-02 20:53:00 INFO home.helloworld: LOGGER/LOG:ID1234 has successfully been received, {"uuid"="def123"}
2014-07-02 20:53:00 INFO home.helloworld: LOGGER/LOG:ID1234 has successfully been transferred, {"uuid"="def123"}
2014-07-02 20:53:00 INFO home.byebyeworld: LOGGER/LOG:ID1234 has successfully been processed, {"uuid"="def123"}
2014-07-02 20:53:00 INFO home.byebyeworld: LOGGER/LOG:ID1234 has exited, {"uuid"="def123"}
由于上述各行表示为单一的“消息” ,我很难用POST休息调用来查询它。我尝试使用包含“必须匹配”只得到我的日志的1号线,但它是不相符的,有时它会返回多个命中,而不是仅仅一重击:
{
"query" : {
"constant_score" : {
"filter" : {
"bool" : {
"must" : [
{ "match_phrase_prefix" : {"message" : "home.helloworld:"}},
{ "match_phrase_prefix" : {"message" : "LOGGER/LOG:ID1234"}},
{ "match" : {"message" : "received, {\"uuid\"=\"abc123\"}"}}
]
}
}
}
}
}
难道我做错了什么上面elasticsearch查询?我认为“必须”等于AND,“匹配”更多的是CONTAINS,“match_phrase_prefix”是STARTSWITH?有人可以告诉我如何正确查询充满上述日志与不同的uuid号码的日志,只返回单击?最初我以为我得到了与上述查询,它首先返回只有1击,但随后返回2,然后更多..这对我来说是不一致的。先谢谢你!!