Atlas Search "Near" Operator Date, Bug?

Hi,

I got problem with Near Operator when i try to use date.

My mapping
image

My pipeline
image
pivot was 1 week in milliseconds

I got date not near in result
image

Thanks for your help

Hi @Jonathan_Gautier,

I would recommend running a simpler query as in our example. Using a direct “near” clause and replacing new Date with
"origin": ISODate("1995-01-01T00:00:00.000+00:00")

Thanks,
Pavel

Hi @Pavel_Duchovny ,

Same ! Near dont work with simpler query :confused:

image

image

Thanks for your help.

Hi @Jonathan_Gautier,

Do you have documents closer to 1995?

Perhaps sort as the next stage asc …

@Pavel_Duchovny

No documents closer to 1995 ! Every time got false/positive result.

near will return all documents, but will score those closer to a date higher. So the first result will be the document closest to new Date("1995")

using near in a must clause will have no effect on a filter as defined on filter or must or mustNot.

If you want to filter your results, you can use a range operator.

1 Like

Thanks for your help, i will use range now.

I understand how near works now :slight_smile:

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.