wu-sheng commented on a change in pull request #6120:
URL: https://github.com/apache/skywalking/pull/6120#discussion_r556416493
##########
File path:
oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/LogQueryEs7DAO.java
##########
@@ -90,8 +123,30 @@ public Logs queryLogs(String metricName, int serviceId, int
serviceInstanceId, S
));
}
+ if (CollectionUtils.isNotEmpty(tags)) {
+ BoolQueryBuilder tagMatchQuery = QueryBuilders.boolQuery();
+ tags.forEach(tag ->
tagMatchQuery.must(QueryBuilders.termQuery(AbstractLogRecord.TAGS,
tag.toString())));
+ mustQueryList.add(tagMatchQuery);
+ }
+
+ if (CollectionUtils.isNotEmpty(keywordsOfContent)) {
+ mustQueryList.add(
+ QueryBuilders.matchPhraseQuery(
+
MatchCNameBuilder.INSTANCE.build(AbstractLogRecord.CONTENT),
+ String.join(Const.SPACE, keywordsOfContent)
+ ));
+ }
+
+ if (CollectionUtils.isNotEmpty(excludingKeywordsOfContent)) {
+ boolQueryBuilder.mustNot(QueryBuilders.matchPhraseQuery(
+ MatchCNameBuilder.INSTANCE.build(AbstractLogRecord.CONTENT),
+ String.join(Const.SPACE, excludingKeywordsOfContent)
+ ));
+ }
+
sourceBuilder.size(limit);
sourceBuilder.from(from);
+ sourceBuilder.sort(AbstractLogRecord.TIMESTAMP);
Review comment:
I think we should add order in LogQueryCondition at the protocol level.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]