Thank you Elle.
A sample document looks like this:
{
"_id": {
"$oid": "636bf48947c869baecdd19f6"
},
"title": "Fairy Tale",
"authors": [
"Stephen King"
],
"price": {
"$numberInt": "100"
},
"genres": [
"Fiction"
],
"identifiers": [
"1668002175",
"9781668002179"
],
"averageRating": {
"$numberDouble": "3.5"
},
"imageLinks": {
"smallThumbnail": "http://books.google.com/books/content?id=jPzjzgEACAAJ&printsec=frontcover&img=1&zoom=5&source=gbs_api",
"thumbnail": "http://books.google.com/books/content?id=jPzjzgEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api"
},
"quantityAvailableForReservation": {
"$numberInt": "1"
},
"totalQuantityListed": {
"$numberInt": "1"
},
"quantityReserved": {
"$numberInt": "0"
},
"description": "Legendary storyteller ...",
"shopSuppliedIdentifier": "9781668002179",
"infoLink": "http://books.google.co.uk/books?id=jPzjzgEACAAJ&dq=isbn:9781668002179&hl=&source=gbs_api",
"bookLibraryId": {
"$oid": "636bf45047c869baecdd19ee"
},
"dateListedForSale": {
"$date": {
"$numberLong": "1668019337373"
}
},
"shopInfo": {
"shopId": {
"$oid": "635b93aaa86789aa76c2bc8a"
},
"charityName": "PDSA",
"addressLine1": "307 High Street",
"addressLine2": "",
"city": "Orpington",
"postcode": "BR6 0NN",
"phone": "01689 871243",
"geolocation": {
"type": "Point",
"coordinates": [
{
"$numberDouble": "0.098295"
},
{
"$numberDouble": "51.373795"
}
]
},
"email": "orpington@pdsa.org"
},
"bestseller": [
{
"bestsellerSource": "New York Times",
"reviewLinks": []
}
]
}
A user needs to be able to search for documents (books) that are in several shops by supplied array of shopIds (any of them should match) and also for books that fall in any one of the three categories (bestsellers, recommended - essentially 4 star or over rating, and new arrivals - essentially listed in the last 30 days) - the user may select one, two or all three categories and any should match (a book may be in all three). So both searches use logical OR. I can include a separate $match stage after $search, which seems the only option available given the constraints of Atlas Search. Is there any other way to do this in the $search stage?
Many thanks.
Kind regards,
Gueorgui