data search

Execute a SOSL text-based search query.

Specify the SOSL query at the command line with the –query flag or read the query from a file with the –file flag.

By default, the results are written to the terminal in human-readable format. If you specify --result-format csv, the output is written to one or more CSV (comma-separated values) files. The file names correspond to the Salesforce objects in the results, such as Account.csv. Both --result-format human and --result-format json display only to the terminal.

Flag Name (Long)Flag Name (Short)Description
‑‑api‑versionN/AType: Value

Override the api version used for api requests made by this command
‑‑file‑fType: Value

File that contains the SOSL query.
‑‑flags‑dirN/AType: Value

Import flag values from a directory.
‑‑jsonN/AType: Boolean

Format output as json.
‑‑query‑qType: Value

SOSL query to execute.
‑‑result‑format‑rType: Value
Valid Values: human, csv, json
Default value: human

Format to display the results, or to write to disk if you specify “csv”.
‑‑target‑org‑oType: Value
Required

Username or alias of the target org. Not required if the target-org configuration variable is already set.

Specify a SOSL query at the command line; the command uses your default org:

Read the SOSL query from a file called “query.txt”; the command uses the org with alias “my-scratch”:

Similar to the previous example, but write the results to one or more CSV files, depending on the Salesforce objects in the results: