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

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

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