elastic/logstash

Extend 'in' operator to check for array subset.

Open

#6.853 geöffnet am 29. März 2017

Auf GitHub ansehen
 (8 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Ruby (14.197 Stars) (3.496 Forks)batch import
discussenhancementhelp wanted

Beschreibung

Currently, the in operator does the following for a in b example:

  • if b is a string, it checks if a is a substring of b
  • if b is a list, it checks if a is an element of b

I propose that we extend the in operator to have the following additional behavior:

  • if b is a list, and a is a list, then a in b should check if a is a subset of the elements in b

Examples:

  • ["a", "b"] in ["a", "b", "c"] == true
  • ["a", "d"] in ["a", "b", "c"] == false

The same goes for field references. Let's suppose the [tags] field is ["web", "frontend", "newyork", "staging"], then the following:

  • ["web", "frontend"] in [tags] == true
  • ["db", "newyork"] in [tags] == false

General idea is to have in act as a subset check if both operands are list values (array literals, fieldreferences that have array values, etc)

Contributor Guide