Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-86965

[v7.0] Enable query stats for $search in 7.0

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.8
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Query Integration
    • Fully Compatible

      While attempting to backport SERVER-76087, the test added in the ticket, search_query_stats.js doesn't pass due to a reparsing error for $search. $searchMeta works fine with SERVER-76087 cherry-picked in.

       "errmsg" : "PlanExecutor error during aggregation :: caused by :: Was not able to re-parse queryStats key when reading queryStats.Status Location40415: BSON field '$_internalSearchMongotRemote.?' is an unknown field. Hash: 12727475762411805085 Query Shape: { cmdNs: { db: \"search_query_stats\", coll: \"search_query_stats\" }, command: \"aggregate\", pipeline: [ { $_internalSearchMongotRemote: { ?: \"?\" } }, { $_internalSearchIdLookup: {} } ] }",

      I think the cause of the difference between 7.0/master is due to the fact that on master, $search is not desugared into internalSearchMongotRemote until after parsing due to SERVER-78159 which was completed before SERVER-76087. Because $search is desugared on parse in 7.0, the reparsing issue is occurring. 

      Something else to consider in this ticket is if the goal is to replicate the same behavior on 7.0 for $search as master. 

      Note: The fact that SERVER-76087 was created before the desugaring change is a red herring. The testing for the ticket body of SERVER-76087 may have been done directly with the $search document source stage. The serialization function for $search was updated in SERVER-76947, but this function shouldn't be used in query stats on 7.0 as the pipeline doesn't contain $search after parsing due to the desugaring. 


            vamsy.annabattula@mongodb.com Vamsy Annabattula
            erin.zhu@mongodb.com Erin Zhu
            0 Vote for this issue
            2 Start watching this issue