To filter for two or more words that occur near to each other.


The contains_near operator takes a comma-separated list of string arguments. Note that the strings cannot contain spaces.

It also includes the span, an integer that specifies how far apart the strings can be. For instance, if span is set to 25, all the strings must appear within any 25 consecutive words in the input object.

For contains_near to succeed, it must find all of the strings within the input object. They can appear in any order.


Not case sensitive. Add the cs keyword to create a case-sensitive filter with contains_near.


contains_near (string, string, .... string:span)




  1. Filter for posts that mention your product by implication, without actually naming it.

    interaction.content near "microsoft,spreadsheet:5"

    The stream will match this target text:

    "Microsoft makes my favorite spreadsheet."

    but not this one:

    "Microsoft makes my favorite desktop spreadsheet."

    Note that we're using the synonym, near.

  2. Filter for posts that mention a company and product. This is useful for names that are common.

    interaction.content contains_near "deere,tractor:50"

  3. Filter for posts that mention a set of words.

    interaction.content contains_near "giraffe,antelope,gorilla,elephant:40"

  4. Filter for posts that refer to a major event even if they do not name it.

    interaction.content contains_near "rangers,giants:30"

    This stream would find references to the 2010 World Series games between the Texas Rangers and the San Francisco Giants that a simpler stream might discard:

    interaction.content contains "2010 World Series"


The span includes the words you are looking for. It is not the gap between them.