Error in vector_search_explain object

Hi,
Object vector_search_explain is missing part of expected structure. Therefore when querying you may obtain the following error message:

You can avoid the error by commenting (put a # before each of the following lines) the following lines:

millis_elapsed = vector_search_explain['explain']['collectStats']['millisElapsed']
print(f"Total time for the execution to complete on the database server: {millis_elapsed} milliseconds")

Within the vector_search_with_filter function which might be declared in the notebook itself or in the custom_utils.py library

Cheers

PS: by doing this you loss the total time of execution, if somebody knows how to overcome this part it would be terrific, I am not proficient in MongoDB

Change the millis elapsed with this call:

millis_elapsed = vector_search_explain['explain']['collectStats']['allCollectorStats']['millisElapsed']

Great, thanks