> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Filtered Stream のオペレーター

> X API v2 Filtered Stream のオペレーター完全リファレンス。ストリームルール向けの keyword、has:、is:、および Enterprise 限定のセマンティック embedding: オペレーターを網羅します。

このページでは、Filtered Stream の [ルール作成](/x-api/posts/filtered-stream/integrate/build-a-rule) で利用可能なオペレーターの完全な一覧を提供します。

## 概要

オペレーターは、投稿の特定の属性にマッチさせるために使用します。次の 2 種類があります:

* **スタンドアロンオペレーター** — 単独でも、他のオペレーターと組み合わせても使用可能
* **接続必須オペレーター** — 少なくとも 1 つのスタンドアロンオペレーターと組み合わせて使用する必要があります

ほとんどのオペレーターは Pay-per-use と Enterprise の両方で利用可能です。一部の高度なオペレーター (セマンティック embedding など) は、追加のティアアクセスを伴う Enterprise が必要です。

***

## キーワードおよびフレーズオペレーター

| Operator                | Type       | Summary                             | Example                               |
| :---------------------- | :--------- | :---------------------------------- | :------------------------------------ |
| `keyword`               | Standalone | 投稿本文内のキーワードにマッチ (トークン化マッチ)          | `pepsi OR cola OR "coca cola"`        |
| `emoji`                 | Standalone | 投稿本文内の絵文字にマッチ                       | `(😃 OR 😡) 😬`                       |
| `"exact phrase"`        | Standalone | 投稿本文内の完全一致フレーズにマッチ                  | `("X API" OR #v2) -"filtered stream"` |
| `"keyword1 keyword2"~N` | Standalone | 近接マッチ — 互いに N トークン以内のキーワード (最大 N=6) | `"social media"~5`                    |

***

## エンティティオペレーター

| Operator | Type       | Summary                | Example                      |
| :------- | :--------- | :--------------------- | :--------------------------- |
| `#`      | Standalone | ハッシュタグを含む投稿にマッチ (完全一致) | `#thankunext #fanart`        |
| `@`      | Standalone | ユーザー名へのメンションを含む投稿にマッチ  | `(@XDevelopers OR @api) -@x` |
| `$`      | Standalone | キャッシュタグを含む投稿にマッチ       | `$twtr OR @XDevelopers -$fb` |

***

## ユーザーオペレーター

| Operator             | Type       | Summary                  | Example                         |
| :------------------- | :--------- | :----------------------- | :------------------------------ |
| `from:`              | Standalone | 特定のユーザーからの投稿にマッチ         | `from:XDevelopers OR from:api`  |
| `to:`                | Standalone | 特定のユーザーへの返信にマッチ          | `to:XDevelopers OR to:api`      |
| `retweets_of:`       | Standalone | 特定のユーザーのリポストにマッチ         | `retweets_of:XDevelopers`       |
| `from_affiliate_of:` | Standalone | 特定のユーザーのアフィリエイトからの投稿にマッチ | `from_affiliate_of:XDevelopers` |
| `to_affiliate_of:`   | Standalone | 特定のユーザーのアフィリエイトへの返信にマッチ  | `to_affiliate_of:XDevelopers`   |

***

## URL オペレーター

| Operator           | Type       | Summary                                            | Example                         |
| :----------------- | :--------- | :------------------------------------------------- | :------------------------------ |
| `url:`             | Standalone | URL のトークン化マッチ (`url` または `expanded_url` フィールドにマッチ) | `url:"https://developer.x.com"` |
| `url_title:`       | —          | 展開された URL の HTML タイトルメタデータに対するキーワードマッチ             | `url_title:snow`                |
| `url_description:` | —          | 展開されたページの説明メタデータに対するキーワードマッチ                       | `url_description:weather`       |
| `url_contains:`    | —          | URL コンテンツに対するリテラルマッチ                               | `url_contains:photos`           |

***

## コンテキストおよびエンティティオペレーター

| Operator           | Type       | Summary                    | Example                                            |
| :----------------- | :--------- | :------------------------- | :------------------------------------------------- |
| `context:`         | Standalone | 特定のドメイン/エンティティのペアを持つ投稿にマッチ | `context:10.799022225751871488` または `context:47.*` |
| `entity:`          | Standalone | 特定のエンティティ文字列値を持つ投稿にマッチ     | `entity:"Michael Jordan"`                          |
| `conversation_id:` | Standalone | 会話スレッド内の投稿にマッチ             | `conversation_id:1334987486343299072`              |

***

## ユーザープロフィールオペレーター

| Operator        | Type       | Summary             | Example                                        |
| :-------------- | :--------- | :------------------ | :--------------------------------------------- |
| `bio:`          | Standalone | 投稿者の自己紹介内のキーワードにマッチ | `bio:developer OR bio:"data engineer"`         |
| `bio_name:`     | Standalone | 投稿者の名前内のキーワードにマッチ   | `bio_name:phd OR bio_name:md`                  |
| `bio_location:` | Standalone | 投稿者の所在地内のキーワードにマッチ  | `bio_location:"big apple" OR bio_location:nyc` |

***

## ロケーションオペレーター

| Operator         | Type       | Summary             | Example                                                     |
| :--------------- | :--------- | :------------------ | :---------------------------------------------------------- |
| `place:`         | Standalone | ロケーションタグ付きの投稿にマッチ   | `place:"new york city" OR place:seattle`                    |
| `place_country:` | Standalone | 国コードを持つ投稿にマッチ       | `place_country:US OR place_country:MX`                      |
| `point_radius:`  | Standalone | ある地点の半径内の投稿にマッチ     | `point_radius:[2.355128 48.861118 16km]`                    |
| `bounding_box:`  | Standalone | バウンディングボックス内の投稿にマッチ | `bounding_box:[-105.301758 39.964069 -105.178505 40.09455]` |

***

## 投稿タイプオペレーター

| Operator       | Type                 | Summary                   | Example                         |
| :------------- | :------------------- | :------------------------ | :------------------------------ |
| `is:retweet`   | Conjunction required | リポストにマッチ                  | `data @XDevelopers -is:retweet` |
| `is:reply`     | Conjunction required | 返信にマッチ                    | `from:XDevelopers is:reply`     |
| `is:quote`     | Conjunction required | 引用投稿にマッチ                  | `"sentiment analysis" is:quote` |
| `is:verified`  | Conjunction required | 認証済みアカウントの投稿にマッチ          | `#nowplaying is:verified`       |
| `-is:nullcast` | Conjunction required | プロモーション投稿を除外 (否定形での使用が必須) | `"mobile games" -is:nullcast`   |

***

## コンテンツタイプオペレーター

| Operator         | Type                 | Summary                    | Example                              |
| :--------------- | :------------------- | :------------------------- | :----------------------------------- |
| `has:hashtags`   | Conjunction required | ハッシュタグを含む投稿にマッチ            | `from:XDevelopers -has:hashtags`     |
| `has:cashtags`   | Conjunction required | キャッシュタグを含む投稿にマッチ           | `#stonks has:cashtags`               |
| `has:links`      | Conjunction required | リンクを含む投稿にマッチ               | `from:XDevelopers has:links`         |
| `has:mentions`   | Conjunction required | メンションを含む投稿にマッチ             | `#nowplaying has:mentions`           |
| `has:media`      | Conjunction required | メディア (写真、GIF、動画) を含む投稿にマッチ | `(kittens OR puppies) has:media`     |
| `has:images`     | Conjunction required | 画像を含む投稿にマッチ                | `#meme has:images`                   |
| `has:video_link` | Conjunction required | ネイティブの X 動画を含む投稿にマッチ       | `#icebucketchallenge has:video_link` |
| `has:geo`        | Conjunction required | ジオロケーションデータを含む投稿にマッチ       | `recommend #paris has:geo`           |

***

## サンプリングおよび言語オペレーター

| Operator  | Type                 | Summary                  | Example                          |
| :-------- | :------------------- | :----------------------- | :------------------------------- |
| `sample:` | Conjunction required | ランダムな割合のサンプル (1-100) を返す | `#nowplaying @spotify sample:15` |
| `lang:`   | Conjunction required | 特定の言語に分類された投稿にマッチ        | `recommend #paris lang:en`       |

***

## ユーザーメトリクスオペレーター

| Operator           | Type | Summary                      | Example                       |
| :----------------- | :--- | :--------------------------- | :---------------------------- |
| `min_followers:`   | —    | 指定した数以上のフォロワーを持つユーザーの投稿にマッチ  | `min_followers:1000`          |
| `followers_count:` | —    | フォロワー数が範囲内のユーザーの投稿にマッチ       | `followers_count:1000..10000` |
| `tweets_count:`    | —    | 投稿数が範囲内のユーザーの投稿にマッチ          | `tweets_count:1000..10000`    |
| `following_count:` | —    | フォロー数が範囲内のユーザーの投稿にマッチ        | `following_count:1000..10000` |
| `listed_count:`    | —    | 指定した数のリストに登録されているユーザーの投稿にマッチ | `listed_count:10..100`        |

***

## 投稿参照オペレーター

| Operator                | Type | Summary                 | Example                                    |
| :---------------------- | :--- | :---------------------- | :----------------------------------------- |
| `in_reply_to_tweet_id:` | —    | 特定の投稿への返信にマッチ           | `in_reply_to_tweet_id:1539382664746020864` |
| `retweets_of_tweet_id:` | —    | 特定の投稿のリポストにマッチ          | `retweets_of_tweet_id:1539382664746020864` |
| `source:`               | —    | 特定のソースアプリケーションからの投稿にマッチ | `source:"X for iPhone"`                    |

***

## 論理オペレーター

| Operator    | Summary       | Example                    |
| :---------- | :------------ | :------------------------- |
| `OR`        | 式間の論理 OR      | `cat OR dog`               |
| Space (AND) | 式間の論理 AND     | `cat dog` (両方必須)           |
| `()`        | 複雑な式のためのグループ化 | `(cat OR dog) -is:retweet` |
| `-`         | 否定/除外         | `cat -grumpy`              |

***

## 埋め込みオペレーター

<Note>
  **Enterprise 限定 — Embedding ティアが必要**

  `embedding:` および `embedding_threshold:` オペレーターは、Filtered Stream 向けに Embedding ティアアクセスがプロビジョニングされた Enterprise アカウントでのみ利用可能です。サポートされていないティアでは、ルール作成は "unavailable operator" エラーで拒否されます。有効化についてはアカウント担当者にお問い合わせください。
</Note>

これらのオペレーターは、完全一致のキーワードを必要とせず、ニューラル埋め込みモデルを使用してクエリとの *意味的類似性* に基づいて投稿にマッチします。

| Operator                   | Type                 | Summary                                                         | Example                                                          |
| :------------------------- | :------------------- | :-------------------------------------------------------------- | :--------------------------------------------------------------- |
| `embedding:"query"`        | Standalone           | クエリと意味的に類似した投稿にマッチ。複数語のクエリは引用符で囲む必要があります。                       | `embedding:"climate change policy"`                              |
| `embedding_threshold:X.XX` | Conjunction required | マッチに必要な最小コサイン類似度 (0.0–1.0)。デフォルトは `0.3`。0.3–0.6 の範囲の値を使用してください。 | `embedding:"cryptocurrency regulation" embedding_threshold:0.45` |

### 主な要件と注意点

* `embedding_threshold:` は、ルール内で **唯一のオペレーター** にはできません。`embedding:` (または他のスタンドアロンオペレーター) と組み合わせてください。
* `embedding:` を **否定しないでください** (例: `-embedding:"..."` はサポートされていません)。
* 短いキーワードよりも、長く説明的な自然言語のクエリの方が良い結果を生み出します。
* 埋め込みクエリの処理は非同期です — 新しく作成されたルールがマッチを開始するまでに数秒かかる場合があります。
* 投稿が埋め込みルールでマッチした場合、配信されるペイロードの `matching_rules` エントリには `embedding_similarity` と `embedding_threshold` が含まれます ([投稿とルールのマッチング](/x-api/posts/filtered-stream/integrate/matching-returned-tweets) を参照)。

**ルールの例:**

* `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"`

***

## 対応言語

`lang:` オペレーターは以下の BCP 47 言語コードに対応しています:

| Language | Code | Language | Code | Language | Code    |
| :------- | :--- | :------- | :--- | :------- | :------ |
| アムハラ語    | `am` | ギリシャ語    | `el` | ポルトガル語   | `pt`    |
| アラビア語    | `ar` | グジャラート語  | `gu` | ルーマニア語   | `ro`    |
| アルメニア語   | `hy` | ヘブライ語    | `iw` | ロシア語     | `ru`    |
| バスク語     | `eu` | ヒンディー語   | `hi` | セルビア語    | `sr`    |
| ベンガル語    | `bn` | ハンガリー語   | `hu` | 簡体字中国語   | `zh-CN` |
| ブルガリア語   | `bg` | インドネシア語  | `in` | スロバキア語   | `sk`    |
| カタルーニャ語  | `ca` | イタリア語    | `it` | スロベニア語   | `sl`    |
| クロアチア語   | `hr` | 日本語      | `ja` | スペイン語    | `es`    |
| チェコ語     | `cs` | カンナダ語    | `kn` | スウェーデン語  | `sv`    |
| デンマーク語   | `da` | 韓国語      | `ko` | タミル語     | `ta`    |
| オランダ語    | `nl` | ラトビア語    | `lv` | テルグ語     | `te`    |
| 英語       | `en` | リトアニア語   | `lt` | タイ語      | `th`    |
| エストニア語   | `et` | マラヤーラム語  | `ml` | 繁体字中国語   | `zh-TW` |
| フィンランド語  | `fi` | マラーティー語  | `mr` | トルコ語     | `tr`    |
| フランス語    | `fr` | ノルウェー語   | `no` | ウクライナ語   | `uk`    |
| ドイツ語     | `de` | ペルシャ語    | `fa` | ウルドゥー語   | `ur`    |
| グルジア語    | `ka` | ポーランド語   | `pl` | ベトナム語    | `vi`    |

***

## 次のステップ

<CardGroup cols={2}>
  <Card title="ルールを作成する" icon="filter" href="/x-api/posts/filtered-stream/integrate/build-a-rule">
    ルールの構文とベストプラクティスを学ぶ
  </Card>

  <Card title="Filtered Stream の概要" icon="bolt" href="/x-api/posts/filtered-stream/introduction">
    Filtered Stream を使い始める
  </Card>

  <Card title="切断の処理" icon="plug" href="/x-api/fundamentals/handling-disconnections">
    ストリーミングの切断に対処する
  </Card>
</CardGroup>
