Everything was functioning correctly with my AEM Headless setup until I restarted my Mac. Post-restart, I've been facing an error when executing a GraphQL query. It is an AEM Headless project, using content fragments and graphql. The error message is:
[AEMHeadless:RESPONSE_ERROR] There was a problem parsing response data: Exception while fetching data: java.lang.IllegalArgumentException: Traversal query (query without index)...; consider creating an index.
Full:
"sdk":"AEMHeadless","sdkDetails":{"serviceURL":"/","endpoint":"graphql/execute.json/my-project/tests-all%3Bformat%3DJPG%3BpreferWebp%3Dtrue%3Bsize%3D%5Bobject%20Object%5D"},"code":"RESPONSE_ERROR","message":"[AEMHeadless:RESPONSE_ERROR] There was a problem parsing response data: Exception while fetching data (/testList) : java.lang.IllegalArgumentException: Traversal query (query without index): SELECT main.* FROM [dam:Asset] AS main WHERE ISDESCENDANTNODE(main, '/content/dam') AND main.[jcr:content/contentFragment] = true AND main.[jcr:content/data/cq:model] = '/conf/my-project/settings/dam/cfm/models/test' ORDER BY main.[jcr:path] OPTION (INDEX TAG[fragments], TRAVERSAL FAIL); called by com.adobe.cq.dam.cfm.graphql.ContentFragmentsFetcher.fetchResource; consider creating an index.","stacktrace":"AEMHeadlessError: [AEMHeadless:RESPONSE_ERROR] There was a problem parsing response data: Exception while fetching data (/testList) : java.lang.IllegalArgumentException: Traversal query (query without index): SELECT main.* FROM [dam:Asset] AS main WHERE ISDESCENDANTNODE(main, '/content/dam') AND main.[jcr:content/contentFragment] = true AND main.[jcr:content/data/cq:model] = '/conf/my-project/settings/dam/cfm/models/test' ORDER BY main.[jcr:path] OPTION (INDEX TAG[fragments], TRAVERSAL FAIL); called by com.adobe.cq.dam.cfm.graphql.ContentFragmentsFetcher.fetchResource; consider creating an index.\n at new <anonymous> (http://localhost:3000/static/js/bundle.js:3387:9)\n at AEMHeadless.__handleRequest (http://localhost:3000/static/js/bundle.js:2780:13)\n at async fetchPersistedQuery (http://localhost:3000/static/js/bundle.js:461:22)\n at async fetchData (http://localhost:3000/static/js/bundle.js:558:20)"
I get 0% read optimization for my queries here: http://localhost:4502/libs/granite/operations/content/diagnosistools/queryPerformance.html
Does someone have a solution? Or something I can try?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @mvotos
You can use this link to generate index definition by providing your query - https://oakutils.appspot.com/generate/index
Since the actual content exists under /content/dam I think the queryPaths should point to it.
Thanks
Narendra
Are you using AEM on-premise? I am wondering if you are facing the issue mentioned here: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-6-5-13-known-issue-whi....
Thanks, right I see the queryPaths here is the whole conf path which may cause issues?
Do you have advice in terms of creating indexes? Should the path itself be to my content fragment assets or rather to the graphql itself, or should we be including both?
Hi @mvotos
Please try this way
1.In the CRX DE Lite interface, navigate to the "Indexing" tab.
2.Create a New Index:
3.Create a new index by clicking the "+" icon or selecting the "New" option.
4.Choose the type of index based on your requirements. For example, you might want to create a Traversal Index.
5.Configure the index parameters, including the name and properties.
Specify Indexing Configuration:
6.Make sure to configure the index based on the traversal query causing the issue.
In your case, the traversal query is looking for assets with specific properties, such as jcr:content/contentFragment and jcr:content/data/cq:model. Ensure that the index configuration includes these properties.
7.Save and Activate:
8.Save the index configuration.
9.Activate the index to make it available for use.
10.Check Query Performance:
After creating the index, revisit the query performance tool at http://localhost:4502/libs/granite/operations/content/diagnosistools/queryPerformance.html.
Confirm that the index is being used and that you see improved read optimization for your queries.
Thank you I appreciate the instructions. Currently do not see an "indexing tab", I thought the process to create an index was to create one under oak:index?
Hi @mvotos
You can use this link to generate index definition by providing your query - https://oakutils.appspot.com/generate/index
Since the actual content exists under /content/dam I think the queryPaths should point to it.
Thanks
Narendra
Great, thank you for that link.
Hi @mvotos
Yes, you are correct.
you create and manage indexes under the /oak:index node in the CRX repository, not under a dedicated "Indexing" tab.
Navigate to the Oak Indexing Configuration:
Create a New Index:
Choose the Index Type:
Configure the Index Parameters:
Thank you for the detailed instructions.
@mvotos Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Views
Likes
Replies