Index only objects and not variants with elastic search

Is is possible to index only the main product and not all the variants in elastic search ?
I don’t see any configuration option in the documentation.
I tried to make a custom worker but it does not seem to work :

public function getProductList(): DefaultElasticSearch6
    $worker = new DefaultElasticSearch6($this->tenantConfig);

    return $worker;

there are to ways of doing that:

  1. Decide at index time what should go into index.
    This you can do in your configuration class for the index in the inIndex method. See for example Config Class and Ecommerce Config.

  2. Decide in ProductListing what to search for
    In product listing you can decide with the option variantMode, on what elements you want to search. See inline docs and these lines for more information.


Thank you it works perfectly.
Maybe it should be added in the doc?