Skip to content

Commit

Permalink
Merge pull request #2405 from ControlSystemStudio/alarm_logging_service
Browse files Browse the repository at this point in the history
Adding support for searching based on alarm tree root
  • Loading branch information
shroffk authored Oct 3, 2022
2 parents 8b25682 + fd017be commit 3c570e2
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public class AlarmLogSearchUtil {
private static final String STARTTIME = "start";
private static final String ENDTIME = "end";

private static final String ROOT = "root";

private static final String CONFIG_INDEX_FORMAT = "_alarms_config";
private static final String STATE_INDEX_FORMAT = "_alarms_state";

Expand Down Expand Up @@ -136,6 +138,25 @@ public static List<AlarmLogMessage> search(ElasticsearchClient client,
);
configSet = true;
break;
case ROOT:
boolQuery.must(
Query.of(b -> b.bool(s -> s.should(
Query.of(q -> q
.wildcard(WildcardQuery.of(w -> w
.field("config").value("state:/" + parameter.getValue().strip() + "*")
)
)
),
Query.of(q -> q
.wildcard(WildcardQuery.of(w -> w
.field("config").value("config:/" + parameter.getValue().strip() + "*")
)
)
)
)))
);
configSet = true;
break;
case SEVERITY:
if (!parameter.getValue().equalsIgnoreCase("*"))
boolQuery.must(WildcardQuery.of(w -> w
Expand Down

0 comments on commit 3c570e2

Please sign in to comment.