How to perform atlas $search on a nested field but only at a specific index. For example, I have an array of objects called “chunks”. I have created the index on the chunks and set the mapping as “dynamic”: true. Below is a sample of two documents
It will return both the documents because the text is present in both the documents. Now what I want the query to perform is like this, to search for a text at a defined path at a specific index in an array rather than searching through all indices
Hi @Chetan_J_Rao and welcome to the community forum!!
If I understand your question correctly, you are trying to perform the search on a specific index of the array in a document.
You can perform the same using a simple $match operation using the below query:
[
{
$match: {
"chunks.2.text": "lorem",
},
},
]
The Atlas search index would be created on a field name and not on the index.
If there is a specific use case where you would like to use the Atlas Search feature, could you help me with more details on the same.
Thanks, but this is not a FTS query. This is a normal match query, which does not have full text search capabilities. How can I achieve the same using $search aggregation pipeline
I have exactly same requirement to search against 0th item and again there will be nested elements i.e. arrays within array. we are storing complex structure but need to restrict search against 0th position for each element. is it supported by atlas search?