Skip to main content

Retrieve search insights

The retrieve search insights action enables you to retrieve and review your past search queries within Glean for a defined date range. By providing structured access to your search history, this action helps you understand your information-seeking patterns, track recurring interests, and analyze your search behavior over time. The action is read-only, idempotent, and does not modify any data or have side effects. Pagination or result limits may apply for very large search histories (implementation-dependent). The results are ordered chronologically by query timestamp and partial results may be returned if the date range is large or if there are system-imposed limits.

Capabilities

  • Retrieves a list of your search queries performed in Glean during a specified time period.
  • Analyze historical search behavior to identify trends or recurring topics.
  • Use in Glean Agents to power workflows that require search history context.
  • Only retrieves search queries for the authenticated user and you cannot access other users search histories.

Limitations

  • The action returns raw search queries, which may include sensitive or personally identifiable information (PII).
  • The date range must be valid, start date before end date, formatted as yyyy-mm-dd.
  • Results are limited to the available search history within your organization’s data retention policy.

Prerequisites and permissions

  • You must have an active Glean account and you must be signed in.
  • No special permissions are required beyond standard user access.
  • The action is available in Glean Agents and may require your admin to enable it in the agent builder or action pack configuration.

Inputs

NameTypeRequiredDefaultAllowed valuesExampleNotes
start_datestringYesNoneyyyy-mm-dd, week ago2025-03-01Inclusive. The beginning of the period to retrieve search queries from.
end_datestringYesNoneyyyy-mm-dd, now2025-03-08Exclusive. Must be after start_date.
  • Both dates must be provided in ISO format (yyyy-mm-dd) or as relative phrases like last week or now.

Outputs

  • Returns a JSON object containing details of the user’s search queries within the specified period.
  • Each entry typically includes:
    • Query text
    • Timestamp
    • Additional metadata if available, such as search context.
  • Example output:
{
"searches": [
{
"query": "project roadmap",
"timestamp": "2025-03-02T10:15:00Z"
},
{
"query": "Q1 OKRs",
"timestamp": "2025-03-03T14:22:00Z"
}
]
}

Usage examples

  • Minimal:
    “What did I search for last week?”
    Returns all your search queries from the previous week.

  • Typical:
    “List all my searches from March 1 to March 8, 2025.”
    Returns your search queries between those dates.

  • Advanced:
    “Show my search history for the last month and highlight repeated queries.”
    Returns your search queries for the last month; further analysis can be performed on the output.

Troubleshooting

Error messageCauseFix
Invalid date formatDates not in yyyy-mm-dd or recognized phraseUse ISO format or supported relative phrases.
End date must be after start dateend_date is before or equal to start_dateAdjust the date range so end_date is after start_date.
No search history foundNo queries in the specified periodTry a different or broader date range.
Permission deniedUser not authenticated or lacks accessSign in to Glean and ensure you have standard user access.

FAQs