esearch
Search for entities in ebuild repositories
TLDR
Search the pubmed database for selective serotonin reuptake inhibitor
Search the protein database using a query and regex
Search the nucleotide database for sequences whose metadata contain insulin and rodents
Display help
SYNOPSIS
esearch [-db database] -query search term | -term query term | -id uid list [options]
PARAMETERS
-db db
Target database (e.g., pubmed, protein, gene, nucleotide)
-query term
Search query in Entrez syntax
-term term
Alternative query term, often used with history
-usehistory
Store search results in history for later use
-id uids
Input list of UIDs to process or restrict
-mindate date
Minimum publication or modification date (YYYY/MM/DD)
-maxdate date
Maximum publication or modification date
-datetype type
Date filter type (pdat, mdat, edat)
-indexterm field:term
Restrict to specific field (e.g., author, title)
-retmax num
Maximum UIDs to return (default 10000)
-rettype type
Output format (count, uid, xml)
-history node
Reference prior history node
-email addr
User email for API compliance
-api-key key
NCBI API key for higher rate limits
DESCRIPTION
esearch is part of the Entrez Direct (EDirect) toolkit developed by NCBI for command-line access to Entrez databases. It performs searches across biomedical and genomic databases like PubMed, Protein, Nucleotide, and Gene, returning unique identifiers (UIDs) matching the query.
Use it to query with terms, filters by date, authors, or fields, and integrate with other EDIRECT tools like efetch for data retrieval or elink for links. Supports history for multi-step queries, avoiding web interface limitations. Ideal for scripting bulk searches, data pipelines, and automation in bioinformatics workflows.
For example, search recent human genes: esearch -db gene -query 'homo sapiens[orgn] AND 2023[dp]'. Outputs UIDs for further processing.
CAVEATS
Requires internet; rate-limited by NCBI (3 req/sec, 10 with API key). History temporary per session. Complex queries may need URL-encoding. Not for production without error handling in scripts.
COMMON USAGE
Pipe UIDs to efetch: esearch -db pubmed -query 'COVID-19' | efetch -format abstract
Count results: esearch -db pubmed -query 'cancer' -rettype count
QUERY SYNTAX
Supports Boolean (AND/OR/NOT), wildcards (*), proximity (~N), MeSH terms, filters like [tiab] for title/abstract, [author] for authors.
HISTORY
Part of Entrez Direct, released by NCBI in 2012. Evolved from EUtils web services (2005+), adding R-based parsing. Regular updates via NCBI toolbox; version 17+ as of 2023 enhances performance and supports new databases.


