elastic/logstash

Extend 'in' operator to check for array subset.

Open

#6 853 ouverte le 29 mars 2017

Voir sur GitHub
 (8 commentaires) (0 réactions) (0 assignés)Ruby (14 197 stars) (3 496 forks)batch import
discussenhancementhelp wanted

Description

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)

Guide contributeur