question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ElasticSearch plugin: ability to get all Product assets

See original GitHub issue

Is your feature request related to a problem? Please describe. It’s quite common to have more than one asset in product listings (e.g. when your frontend needs switching between two images on hover). So in that case featuredAsset is not enough. When you store the assets in Product, you want to have access to it from ProductVariant.

For now there is a problem using ElasticsearchPlugin to get product.assets as the array does’t exist due to not being joined on fetch (see the example below).

customProductMappings: {
    secondaryFeaturedAssetPreview: {
        graphQlType: 'String',
        valueFn: (product) => {
            // product.assets doesn't exist
            // so you can't return product assets info
        },
    },
}

Example query for above scenario:

{
  search(input: { collectionId: 1, groupByProduct: true }) {
    items {
      productName
      customMappings {
        ...on CustomProductMappings {
          secondaryFeaturedAssetPreview
        }
      }
    }
  }
}

Describe the solution you’d like Any ability to get Product assets without making indexing much slower.

Describe alternatives you’ve considered. Actually the case when you use all assets in listings is very rare. Many people need just one more except the featured. So maybe the better way is to add secondary featured asset? But this is not a minimalist approach - basically one featured image is enough.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Izaydacommented, Sep 17, 2021

I can get this

0reactions
michaelbromleycommented, Oct 11, 2021

Hi @Izayda The first idea sounds worth exploring. Support for lists in customMappings can be implemented first, and then this feature built on top. I prefer that to the 2nd option, because it is inevitable that people will at some point want to index other relations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cat plugins API | Elasticsearch Guide [8.5] | Elastic
Returns a list of plugins running on each node of a cluster. Requestedit. GET /_cat/plugins. Prerequisitesedit.
Read more >
Plugins | Elasticsearch Guide [8.5] | Elastic
Plugins are a way to enhance the basic Elasticsearch functionality in a custom manner. They range from adding custom mapping types, custom analyzers...
Read more >
Elasticsearch Plugins and Integrations [8.5] | Elastic
Elastic Cloud. Maximize value and optimize your experience. Deploy everything Elastic has to offer across any cloud, in minutes.
Read more >
Listing, Removing and Updating Installed Plugins - Elastic
Listing pluginsedit. A list of the currently loaded plugins can be retrieved with the list option: sudo bin/elasticsearch-plugin list.
Read more >
Plugin Management | Elasticsearch Plugins and Integrations ...
Use the elasticsearch-plugin command line tool to install, list, and remove ... Otherwise run bin/elasticsearch-plugin as the user that owns all of the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found