in oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/ESEventQueryDAO.java [79:126]
private void buildMustQueryListByCondition(final EventQueryCondition condition,
final BoolQueryBuilder query) {
if (IndexController.LogicIndicesRegister.isMergedTable(Event.INDEX_NAME)) {
query.must(Query.term(IndexController.LogicIndicesRegister.METRIC_TABLE_NAME, Event.INDEX_NAME));
}
if (!isNullOrEmpty(condition.getUuid())) {
query.must(Query.term(Event.UUID, condition.getUuid()));
}
final Source source = condition.getSource();
if (source != null) {
if (!isNullOrEmpty(source.getService())) {
query.must(Query.term(Event.SERVICE, source.getService()));
}
if (!isNullOrEmpty(source.getServiceInstance())) {
query.must(Query.term(Event.SERVICE_INSTANCE, source.getServiceInstance()));
}
if (!isNullOrEmpty(source.getEndpoint())) {
query.must(Query.matchPhrase(
MatchCNameBuilder.INSTANCE.build(Event.ENDPOINT),
source.getEndpoint()
));
}
}
if (!isNullOrEmpty(condition.getName())) {
query.must(Query.term(Event.NAME, condition.getName()));
}
if (condition.getType() != null) {
query.must(Query.term(Event.TYPE, condition.getType().name()));
}
final Duration startTime = condition.getTime();
if (startTime != null) {
if (startTime.getStartTimestamp() > 0) {
query.must(Query.range(Event.START_TIME).gt(startTime.getStartTimestamp()));
}
if (startTime.getEndTimestamp() > 0) {
query.must(Query.range(Event.END_TIME).lt(startTime.getEndTimestamp()));
}
}
if (!isNullOrEmpty(condition.getLayer())) {
query.must(Query.term(Event.LAYER, condition.getLayer()));
}
}