0

I have a question for the community regarding pattern detection with Esper.

Suppose you want to detect the following pattern among a collection of data : A B C

However, it is possible, that in the actual data, you might have: A,B,D,E,C. My goal is to design a rule that could still detect A B C by keeping A B in memory, and fire the alert as soon as it sees C.

Is it possible to do this? With the standard select * from pattern(a = event -> b= event -> c=event), It only outputs when the three are in sequence in the data, but not when there are other useless data between them

laune
  • 31,114
  • 3
  • 29
  • 42

1 Answers1

0

With the standard "select * from pattern [a=A -> b=B]" there can be any events between A and B. Your statement is therefore wrong. I think you are confused about how to remove useless data. Use a filter such as "a=event(...not useless...) -> b=event(...not useless...)". Within the parens place the filter expressions that distinguish between useless and not useless events, i.e. "a=event(amount>10)" or whatever.

user3613754
  • 816
  • 1
  • 5
  • 5
  • I tried an example on : http://esper-epl-tryout.appspot.com/epltryout/mainform.html Here are four events that you can copy in the "Advance Time and Send Events" field: StockTick={symbol='GE', price=20.5} StockTick={symbol='YHOO', price=65} StockTick={symbol='alpha', price=10.5} StockTick={symbol='beta', price=12.5} – benjamin steiner Jan 26 '15 at 12:45
  • And here is the query that you can write in the EPL module text field : create schema StockTick(symbol string, price double); select * from pattern[a= StockTick -> b= StockTick] where a.price=20.5 and b.price=10.5 – benjamin steiner Jan 26 '15 at 12:45
  • Unfortunately, this query doesn't output anything even if there are two events that match the EPL rule :( @user3613754 – benjamin steiner Jan 26 '15 at 12:46
  • The filter expressions don't go into the where clause. Each filter expression is right part of the pattern. Like so: select * from pattern[a= StockTick(price=20.5) -> b= StockTick(price=10.5)] – user3613754 Jan 26 '15 at 14:15