$search in aggregation not working

Hi all,

I am trying to do an aggregation pipeline for my text search + filtering.

Using a $match operator for the text search does work. However, I would like to move to compound search to do more customizations like “boost” on certain results.

I tried creating a simple pipeline and I got nothing:

[
  { 
    "$search": {
      "text": {
        "query": "quest",
        "path": "title"
      }
    }
  }
]

I am on version 6+. I have many items with a title field that has the word quest in it. Ideally, I would like to search my entire text index and not a single field. Some help would be appreciated!

What’s not working? What is your index configuration and index name?

I get no response from the above aggregation.

My index name is very long (I didn’t name it) - brands_text_title_text_categories_text_search_keywords_text_colors_text_genders_text_conditions_text_reddit_subreddit_text_sizes_text_countries_text_shipping_info_text_price_text_reddit_author_text_reddit_post_id_text_reddit_thread_id_text_reddit_comment_id_text

It is a text index.

Hi Berk - could you provide the index definition in the same way you provided the query definition above?

Sorry about that, I’m new to MongoDB.

I’m not sure where to find the index definition. It says “_fts (text)” and “_ftsx↑” under my index. It also says Type is “TEXT” and Properties is “COMPOUND”.

Are you using the Atlas web interface? If so, once you login to Atlas, click “Atlas Search” from the navigation menu on the left side, select the cluster you’re querying, and you should see a list of your search indexes. Click into the index you’re querying then open the “Edit Index Definition” dropdown in the top right and click “With JSON Editor”