Use GetMappingsRequest instead of GetIndexRequest in QueryPlanningTool#4785
Use GetMappingsRequest instead of GetIndexRequest in QueryPlanningTool#4785owaiskazi19 wants to merge 1 commit into
Conversation
PR Reviewer Guide 🔍(Review updated until commit 33441c5)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 33441c5 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 33441c5
Suggestions up to commit 00b97d2
Suggestions up to commit 702c3c0
Suggestions up to commit 16120a8
Suggestions up to commit adda5de
|
|
Persistent review updated to latest commit 16120a8 |
16120a8 to
702c3c0
Compare
|
Persistent review updated to latest commit 702c3c0 |
rithinpullela
left a comment
There was a problem hiding this comment.
Thanks for the PR Owais!
|
Persistent review updated to latest commit 00b97d2 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4785 +/- ##
============================================
+ Coverage 77.40% 77.42% +0.01%
- Complexity 11898 11903 +5
============================================
Files 963 963
Lines 53309 53310 +1
Branches 6500 6500
============================================
+ Hits 41265 41274 +9
+ Misses 9293 9286 -7
+ Partials 2751 2750 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
the change make sense, only the mapping is used for query planning. The only thing that comes out of my mind is to double check if there is any conflicts with indexInsightTool? I think people could use indexInsightTool with queryPlanningTool. I think it should be fine, if LLM call indexInsightTool first, which generate index insight, then use queryPlanningTool to generate a suitable query. This is my theory, but have you test this case? |
Index Insight's StatisticalDataTask already uses GetMappingsRequest independently. Both the tools are independent of each other. |
make sense. I took a peak at the IndexInsightTool and it seems there are similar operations, like get index mapping, search few sample documents, make a model inference should think about extracting the similar operations into a utility class when more and more repetitive codes are merged. |
QueryPlanningTool only needs index mappings but was using GetIndexRequest which requires the broader indices:admin/get permission. This change switches to GetMappingsRequest which only requires indices:admin/mappings/get, following the principle of least privilege and aligning with how other tools (knn, query_assistant) request mappings. Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
00b97d2 to
33441c5
Compare
|
Persistent review updated to latest commit 33441c5 |
|
Persistent review updated to latest commit 33441c5 |
Description
QueryPlanningToolusesGetIndexRequestto retrieve index mappings for query planning, but it only accesses.mappings()from the response.GetIndexRequestrequires theindices:admin/getpermission, which also exposes index settings, aliases, and defaults — none of which QPT uses.This PR switches to
GetMappingsRequest/GetMappingsResponse, which only requiresindices:admin/mappings/get. This:knn_full_accessandquery_assistant_accessroles already handle mapping retrievalml_full_accessrole to support Agentic Search (QueryPlanningTool) with the narrowerindices:admin/mappings/getpermission instead of the broaderindices:admin/getRelated Issue
Resolves #4775
Changes
QueryPlanningTool.java:GetIndexRequest→GetMappingsRequestGetIndexResponse→GetMappingsResponseclient.admin().indices().getIndex()→client.admin().indices().getMappings().mappings()returns the sameMap<String, MappingMetadata>QueryPlanningToolTests.java:GetMappingsResponseindicesAdminClient.getIndex()→indicesAdminClient.getMappings()Check List
--signoff