에 "일치해야합니다"I는 I 찾을 ElasticSearch 쿼리를 사용하고자하는 나의 로그에 다음과 같습니다 elasticsearch에서 하나의 "메시지"로 표현된다 위 라인의 각 이후Elasticsearch 쿼리 로그
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을 얻기 위해 아래와 같이 "일치해야합니다"사용하여 시도하지만 가끔은 대신 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 쿼리와 아무 잘못을하고있는 중이 야 ? 나는 "must"가 AND와 같고 "match"가 더 많이 포함되었다고 생각했다. "match_phrase_prefix"는 STARTSWITH인가? 누군가가 위의 로그가 다른 uuid 번호로 채워진 로그를 올바르게 쿼리하고 단일 히트 만 리턴하는 방법을 보여 주실 수 있습니까? 원래 내가 위의 쿼리를 가지고 있다고 생각했는데, 처음에는 1 개의 히트를 리턴했지만 그 다음에는 2 개를 리턴했습니다. 내게 일관성이 없습니다. 미리 감사드립니다 !!