Docs Menu
Docs Home
/
MongoDB Atlas
/ /

View Query Analytics

On this page

  • Navigate to the Query Analytics Page
  • In Atlas, go to the Clusters page for your project.
  • Go to the Atlas Search page for your cluster.
  • Click the name of the index.
  • Click Query Analytics to view analytics for tracked queries run using this Atlas Search index.
  • View Query Analytics for Tracked Search Terms
  • Metrics for All Tracked $search Queries
  • Metrics for Queries with no Results
  • Factors That Affect Displayed Data
  • Continue Learning

You can view metrics for the Atlas Search query terms tracked using the tracking option in the Atlas UI Query Analytics page for the index that you used to query for the term. To learn how to tag search terms in your queries, see Track Search Terms.

This page describes the metrics that Atlas captures for tracked queries and how to view the query analytics for an Atlas Search index in the Atlas UI.

Note

You must have an M10 or higher cluster running MongoDB v5.0 or higher to view the analytics information for the tracked search terms in the Atlas UI. Atlas Search doesn't track search terms or display analytics for queries on free and shared-tier clusters.

1
  1. If it is not already displayed, select the organization that contains your desired project from the Organizations menu in the navigation bar.

  2. If it is not already displayed, select your desired project from the Projects menu in the navigation bar.

  3. If the Clusters page is not already displayed, click Database in the sidebar.

2

You can go the Atlas Search page from the sidebar, the Data Explorer, or your cluster details page.

  1. In the sidebar, click Atlas Search under the Services heading.

  2. From the Select data source dropdown, select your cluster and click Go to Atlas Search.

  1. Click the Browse Collections button for your cluster.

  2. Expand the database and select the collection.

  3. Click the Search Indexes tab for the collection.

  1. Click the cluster's name.

  2. Click the Atlas Search tab.

3

The page displays an overview of this index, including Index Configurations and Field Mappings in the index definition. The left-hand side of the page also provides navigation options to the following pages:

4

Atlas displays query analytics for queries for tracked search terms that were run using only the selected index.

The Query Analytics page displays the following for a predefined date range such as the current day, last 7 days, last 30 days, or last 90 days, or a custom range (in UTC) that you specify, with a per day granularity:

  • Metrics for All Tracked $search Queries

  • Metrics for Queries with no Results

Screenshot of Query Analytics for an Atlas Search Index
click to enlarge

This section shows the following metrics:

  • Approx # of Tracked $search Queries - approximate count of $search queries that included the tracking option.

  • Approx % of Top 10 Tracked Queries - percentage of $search queries with the tracking option that are also the top 10 queries.

The section also shows a graph of the number of tracked queries for the selected date range.

You can expand Show Top Search Queries below the graph to view the following metrics:

Search Terms
Atlas Search query terms (one per row).
Approx #
Approximate number of all tracked $search queries for the term (in the same row).
Approx %

Approximate percentage of all tracked $search queries for the term (in the same row). This is the percentage of queries with the query term, out of the total number of queries, only on days when Atlas captured the query during the selected date range.

Example

Given an Atlas Search query for the term coffee, the percentage is calculated as shown below:

  • 2 queries for coffee out of a total of 8 queries on captured days equals to 16%.

  • 4 queries for coffee out of a total of 8 queries on captured days equals to 50%.

  • 1 query for coffee out of a total of 2 queries on captured days equals to 50%.

View

Link to view the following metrics over a predefined or custom date range for the term (in the same row):

  • Number of queries and percentage of tracked queries for the term in the selected date range.

  • Graph of the number of tracked queries for the term during the selected date range.

Click View factors affecting data to open a window that displays the days when there were no recorded queries for the search term and information about factors that affect the metrics that Atlas Search displays on the page. To learn more, see Factors That Affect Displayed Data. You can click Close to dismiss the window.

To learn more, see how Atlas captures search terms.

The Aggregation pipeline Query section displays the following:

  • Sample aggregation pipeline dropdown that shows the different queries that Atlas captured for the term.

  • MongoDB API tab that shows the mongosh query associated with the selected pipeline.

  • Export to Language tab that allows you to view, copy, and export query syntax in other supported MongoDB driver languages.

  • Open Aggregation Pipeline link to open the Aggregation tab for the collection. To run your query against the collection in the Aggregation tab:

    1. Copy your query.

    2. Click Create New in the Aggregation tab.

    3. Enable Preview if it isn't already enabled and click </> Text.

    4. Paste your query in the left pane to view the results in the Pipeline Output pane on the right.

Click < Query Analytics to return the Query Analytics page.

This section shows the following metrics for queries for which Atlas didn't return any results for the whole aggregation pipeline:

  • Approx # of Search Queries With No Results - approximate count of $search queries with the tracking option for which Atlas Search didn't return results.

  • Approx % of Search Queries With No Results - approximate percentage of $search queries with the tracking option for which Atlas Search didn't return any results.

For the selected date range, the section also shows a graph of the number of tracked queries for which Atlas Search didn't return any results.

You can expand Show Top No Results Queries below the graph to view the following metrics:

Search Terms
Atlas Search query terms (one per row).
Approx # of Searches
Approximate number of queries for the term (in the same row).
Approx % of all Tracked Searches

Approximate percentage of tracked queries for the term (in the same row). This is the percentage of queries with the query term, out of the total number of queries, only on days when Atlas captured the query during the selected date range.

Example

Given an Atlas Search query for the term coffee, the percentage is calculated as shown below:

  • 2 queries for coffee of a total of 8 queries on captured days equals to 16%.

  • 4 queries for coffee out of a total of 8 queries on captured days equals to 50%

  • 1 query for coffee out of a total of 2 queries on captured days equals to 50%

View

Link to view the following metrics over a predefined or custom date range for the term (in the same row):

  • Number and percentage of all tracked $search queries for the term in the selected date range.

  • Graph of the number of tracked $search queries for the term during the selected date range.

Click View factors affecting data to open a window that displays the days when there were no recorded queries for the search term and information about factors that affect the metrics that Atlas Search displays on the page. To learn more, see Factors That Affect Displayed Data. You can click Close to dismiss the window.

To learn more, see how Atlas captures search terms.

The Aggregation pipeline Query section displays the following:

  • Sample aggregation pipeline dropdown that shows the different queries that Atlas captured for the term.

  • MongoDB API tab that shows the mongosh query associated with the selected pipeline.

  • Export to Language tab that allows you to view, copy, and export query syntax in other supported MongoDB driver languages.

  • Open Aggregation Pipeline link to open the Aggregation tab for the collection. To run your query against the collection in the Aggregation tab:

    1. Copy your query.

    2. Click Create New in the Aggregation tab.

    3. Enable Preview if it isn't already enabled and click </> Text.

    4. Paste your query in the left pane to view the results in the Pipeline Output pane on the right.

Click < Query Analytics to return the Query Analytics page.

Many factors affect the metrics that are displayed on the page.

Atlas Search query metrics is based on sampling, which can affect the accuracy of all the displayed metrics.

In addition, Atlas has a limit on the number of unique search terms that Atlas captures each day from tracked $search queries. Once Atlas reaches the limit, it doesn't capture new, unique search terms. The following might be affected if Atlas reaches the limit:

  • The approximate percentage of top 10 tracked queries

  • The order in which Atlas displays the top search terms

Individual tracked search term metrics might be affected if Atlas stopped capturing before queries for a search term ran. On those days, Atlas doesn't display the number of searches for that search term, resulting in a gap.

To learn more, see Behavior.

Follow along with this video to learn how you can use query analytics to retrieve metrics on the top 10 query terms and query terms for which Atlas Search didn't return any results. Also learn how you can use synonyms to improve the search for terms for which Atlas Search didn't return any results.

Duration: 7 Minutes

Back

Review Metrics

Next

Improve Performance