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.
Flags
Flag Name (Long)
Flag Name (Short)
Description
‑‑api‑version
N/A
Type: Value
Override the api version used for api requests made by this command
‑‑file
‑f
Type: Value
File that contains the SOSL query.
‑‑flags‑dir
N/A
Type: Value
Import flag values from a directory.
‑‑json
N/A
Type: Boolean
Format output as json.
‑‑query
‑q
Type: Value
SOSL query to execute.
‑‑result‑format
‑r
Type: 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
‑o
Type: Value Required
Username or alias of the target org. Not required if the target-org configuration variable is already set.
Examples for data search
Specify a SOSL query at the command line; the command uses your default org:
1sf data search --query "FIND {Anna Jones} IN Name Fields RETURNING Contact (Name, Phone)"
Read the SOSL query from a file called “query.txt”; the command uses the org with alias “my-scratch”:
1sf data search --file query.txt --target-org 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:
1sf data search --file query.txt --target-org my-scratch --result-format csv