#community-help

Troubles with Flattening Nested Field in Index

TLDR User Mojan had problems flattening a nested field in an index. User Jason advised to use 'versions.doc_description' instead of 'doc_description' in the search query.

Powered by Struct AI
+11
3
2w
Solved
Join the chat
Sep 12, 2023 (2 weeks ago)
Mojan
Photo of md5-813f8f14e16940e952eb3fe25d0c4523
Mojan
06:11 PM
Hey guys I am trying to flatten a nested field in my index. The data structure is as below :

{
 ...
'versions' : [{ 'doc_description': string]
}

I have tried doing this :

{
                'name': 'versions.doc_description',
                'type': 'string[]',
                'facet': True
            },

but keeps getting the error shown in the screenshot (not found).

Does anyone have an idea how I should go about this ?
Image 1 for Hey guys I am trying to flatten a nested field in my index. The data structure is as below :<br><br><pre><code>{
 ...
'versions' : [{ 'doc_description': string]
}</code></pre><br>I have tried doing this :<br><br><pre><code>{
                'name': 'versions.doc_description',
                'type': 'string[]',
                'facet': True
            },</code></pre><br>but keeps getting the error shown in the screenshot (not found).<br><br>Does anyone have an idea how I should go about this ?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:16 PM
The schema is correct, but it sounds like the search query is using doc_description instead of versions.doc_description
Mojan
Photo of md5-813f8f14e16940e952eb3fe25d0c4523
Mojan
06:19 PM
Thank you, Jason !
+11