Hi Everyone,
I have a few thousand documents I’m trying to make an Atlas lucene search index for, on a specific field.
An extremely simplified version of my docs look like this…
{
name:'XYZ',
lastUpdated: date 1,
fundamentalData:{
description: stuff,
latUpdatedFA: date 2,
},
}
When i try to build a very simple search index on fundamentalData**.description,** I continuously get a failure to build message.
’ Your index could not be built: Unexpected error: DocValuesField “$type:date/lastUpdated” appears more than once in this document (only one value is allowed per field) ’
This indicates that the key/field ‘lastUpdated’ appears more than once in a given document, but I have confirmed via python that it in fact does not. (see code at the end)
I also know that fundamentalData.lastUpdatedFA is similar to lastUpdated, but this should not matter, as I have confirmed that as long as it’s not character for character, it’s not a problem.
Thoughts? When i create the search index the old fashioned way on a localhost copy of my database via …
db.collection.createIndex( { Description: "text" } )
… everything works perfectly fine. It’s my understanding that the Atlas Search algorithm behaves quite differently than the legacy createIndex, though.
Thanks,
Logan
`
def find_duplicate_lastUpdated(collection):
duplicate_lastUpdated_docs =
for doc in collection.find():
lastUpdated_count = str(doc).count(“‘lastUpdated’”)
if lastUpdated_count > 1:
duplicate_lastUpdated_docs.append(doc[‘name’])
time.sleep(0.01) # sleep for 10 milliseconds
return duplicate_lastUpdated_docs
collection = db[“assetdatas”]
duplicates = find_duplicate_lastUpdated(collection)
len(duplicates)
`