Skip to main content
This page provides a complete list of operators available when building rules for Filtered Stream.

Overview

Operators are used to match on specific Post attributes. There are two types:
  • Standalone operators — Can be used alone or with any other operators
  • Conjunction-required operators — Must be used with at least one standalone operator
Some advanced operators (such as semantic embedding) require Embedding tier access in addition to Enterprise.

Keyword and phrase operators

OperatorTypeSummaryExample
keywordStandaloneMatches a keyword within the Post body (tokenized match)pepsi OR cola OR "coca cola"
emojiStandaloneMatches an emoji within the Post body(😃 OR 😡) 😬
"exact phrase"StandaloneMatches the exact phrase within the Post body("X API" OR #v2) -"filtered stream"
"keyword1 keyword2"~NStandaloneProximity match — keywords within N tokens of each other (max N=6)"social media"~5

Entity operators

OperatorTypeSummaryExample
#StandaloneMatches Posts containing a hashtag (exact match)#thankunext #fanart
@StandaloneMatches Posts mentioning a username(@XDevelopers OR @api) -@x
$StandaloneMatches Posts containing a cashtag$twtr OR @XDevelopers -$fb

User operators

OperatorTypeSummaryExample
from:StandaloneMatches Posts from a specific userfrom:XDevelopers OR from:api
to:StandaloneMatches Posts in reply to a specific userto:XDevelopers OR to:api
retweets_of:StandaloneMatches Retweets of a specific userretweets_of:XDevelopers

URL operators

OperatorTypeSummaryExample
url:StandaloneTokenized match on URL (matches url or expanded_url fields)url:"https://developer.x.com"
url_title:Keyword match on expanded URL HTML title metadataurl_title:snow
url_description:Keyword match on expanded page description metadataurl_description:weather
url_contains:Literal match on URL contenturl_contains:photos

Context and entity operators

OperatorTypeSummaryExample
context:StandaloneMatches Posts with a specific domain/entity paircontext:10.799022225751871488 or context:47.*
entity:StandaloneMatches Posts with a specific entity string valueentity:"Michael Jordan"
conversation_id:StandaloneMatches Posts in a conversation threadconversation_id:1334987486343299072

User profile operators

OperatorTypeSummaryExample
bio:StandaloneMatches keyword in Post author’s biobio:developer OR bio:"data engineer"
bio_name:StandaloneMatches keyword in Post author’s namebio_name:phd OR bio_name:md
bio_location:StandaloneMatches keyword in Post author’s locationbio_location:"big apple" OR bio_location:nyc

Location operators

OperatorTypeSummaryExample
place:StandaloneMatches Posts tagged with a locationplace:"new york city" OR place:seattle
place_country:StandaloneMatches Posts with a country codeplace_country:US OR place_country:MX
point_radius:StandaloneMatches Posts within a radius of a pointpoint_radius:[2.355128 48.861118 16km]
bounding_box:StandaloneMatches Posts within a bounding boxbounding_box:[-105.301758 39.964069 -105.178505 40.09455]

Post type operators

OperatorTypeSummaryExample
is:retweetConjunction requiredMatches Retweetsdata @XDevelopers -is:retweet
is:replyConjunction requiredMatches repliesfrom:XDevelopers is:reply
is:quoteConjunction requiredMatches Quote Tweets"sentiment analysis" is:quote
is:verifiedConjunction requiredMatches Posts from verified authors#nowplaying is:verified
-is:nullcastConjunction requiredExcludes promotional Posts (must be negated)"mobile games" -is:nullcast

Content type operators

OperatorTypeSummaryExample
has:hashtagsConjunction requiredMatches Posts with hashtagsfrom:XDevelopers -has:hashtags
has:cashtagsConjunction requiredMatches Posts with cashtags#stonks has:cashtags
has:linksConjunction requiredMatches Posts with linksfrom:XDevelopers has:links
has:mentionsConjunction requiredMatches Posts with mentions#nowplaying has:mentions
has:mediaConjunction requiredMatches Posts with media (photo, GIF, video)(kittens OR puppies) has:media
has:imagesConjunction requiredMatches Posts with images#meme has:images
has:video_linkConjunction requiredMatches Posts with native X videos#icebucketchallenge has:video_link
has:geoConjunction requiredMatches Posts with geolocation datarecommend #paris has:geo

Sampling and language operators

OperatorTypeSummaryExample
sample:Conjunction requiredReturns a random percent sample (1-100)#nowplaying @spotify sample:15
lang:Conjunction requiredMatches Posts classified as a specific languagerecommend #paris lang:en

User metrics operators

OperatorTypeSummaryExample
followers_count:Matches Posts from users with follower count in rangefollowers_count:1000..10000
tweets_count:Matches Posts from users with Post count in rangetweets_count:1000..10000
following_count:Matches Posts from users with following count in rangefollowing_count:1000..10000
listed_count:Matches Posts from users in specified number of Listslisted_count:10..100

Post reference operators

OperatorTypeSummaryExample
in_reply_to_tweet_id:Matches replies to a specific Postin_reply_to_tweet_id:1539382664746020864
retweets_of_tweet_id:Matches Retweets of a specific Postretweets_of_tweet_id:1539382664746020864
source:Matches Posts from a specific source applicationsource:"X for iPhone"

Logical operators

OperatorSummaryExample
ORLogical OR between expressionscat OR dog
Space (AND)Logical AND between expressionscat dog (both required)
()Grouping for complex expressions(cat OR dog) -is:retweet
-Negation/exclusioncat -grumpy

Semantic operators

Requires Embedding tierThe embedding: and embedding_threshold: operators require Embedding tier access on your Enterprise Filtered Stream instance. If not provisioned, rule creation will fail with an “‘embedding’ is not an available operator” error.
These operators use a neural embedding model to match Posts by semantic similarity to a query, rather than requiring exact keyword matches.
OperatorTypeSummaryExample
embedding:"query"StandaloneMatches Posts semantically similar to the query. Multi-word queries must be quoted.embedding:"climate change policy"
embedding_threshold:X.XXConjunction requiredMinimum cosine similarity for a match (0.0–1.0). Defaults to 0.3. Use values between 0.3–0.6.embedding:"cryptocurrency regulation" embedding_threshold:0.45

Key requirements and notes

  • embedding_threshold: cannot be the only operator in a rule. Pair it with embedding: (or another standalone operator).
  • Do not negate embedding: (e.g. -embedding:"..." is unsupported).
  • Longer, descriptive natural language queries produce better results than short keywords.
  • Embedding query processing is asynchronous — newly created rules may take a few seconds before they begin matching.
  • When a Post matches via an embedding rule, the delivered payload’s matching_rules entries will contain embedding_similarity and embedding_threshold (see Matching Posts to Rules).
Example rules:
  • embedding:"electric vehicle announcements" lang:en -is:retweet has:links
  • embedding:"natural disaster relief" embedding_threshold:0.45 has:media
  • embedding:"renewable energy" embedding_threshold:0.4 OR embedding:"solar power investment"

Supported languages

The lang: operator supports these BCP 47 language codes:
LanguageCodeLanguageCodeLanguageCode
AmharicamGreekelPortuguesept
ArabicarGujaratiguRomanianro
ArmenianhyHebrewiwRussianru
BasqueeuHindihiSerbiansr
BengalibnHungarianhuSimplified Chinesezh-CN
BulgarianbgIndonesianinSlovaksk
CatalancaItalianitSloveniansl
CroatianhrJapanesejaSpanishes
CzechcsKannadaknSwedishsv
DanishdaKoreankoTamilta
DutchnlLatvianlvTelugute
EnglishenLithuanianltThaith
EstonianetMalayalammlTraditional Chinesezh-TW
FinnishfiMarathimrTurkishtr
FrenchfrNorwegiannoUkrainianuk
GermandePersianfaUrduur
GeorgiankaPolishplVietnamesevi

Next steps

Build a rule

Learn rule syntax and best practices

Filtered Stream introduction

Get started with Filtered Stream

Handling disconnections

Handle streaming disconnections