magento / magento/community-features

Allow setting returned fields in search_request.xml

Open
#178 2 comments 0 reactions 0 assignees View on GitHub
Priority: P3
Dominant language
No language data
Stars
46
Forks
14
PR merge metrics
No merged PRs in 30d

Description

### Summary (*)

It's not possible to customize fields returned by search engines (for example Elasticsearch) in `search_request.xml`.

### Examples (*)

In the case of Elasticsearch, `Magento\Elasticsearch\SearchAdapter\Query\Builder` forces the returned fields to be `['_id', '_score']`. This is OK in the case of product search, because you can fetch the remaining data through the product repository using the returned product IDs. But in simpler search cases, it would be nice to return the fields directly from the search index.

### Proposed solution

I could provide a PR for this, but is there an explicit reason this is not possible at the moment? Maybe some incompatibility issue between search engines, which prevents this being part of the `search_request.xml` abstraction?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with search_request.xml and Magento\Elasticsearch\SearchAdapter\Query\Builder, where the issue says returned fields are forced to _id and _score. Compare how other search engines handle requested fields and determine what configuration is compatible across the search abstraction; done means supported fields can be configured without breaking product search.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch
Domain
backend-api-design, search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.