Magento OOTB is displaying data from default billing address in customer grid. I need data from default shipping address instead of billing. I made changes in indexer.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <indexer id="customer_grid" view_id="customer_dummy" class="Magento\Framework\Indexer\Action\Entity" primary="customer">
        <fieldset name="shipping" source="Magento\Customer\Model\ResourceModel\Address\Collection">
            <reference fieldset="customer" from="entity_id" to="default_shipping"/>
            <field name="full" xsi:type="searchable" dataType="text" handler="ShippingAddressHandler"/>
            <field name="street" xsi:type="searchable" dataType="varchar"/>
            <field name="firstname" xsi:type="searchable" dataType="varchar"/>
            <field name="lastname" xsi:type="searchable" dataType="varchar"/>
            <field name="city" xsi:type="searchable" dataType="varchar"/>
            <field name="company" xsi:type="searchable" dataType="varchar"/>
            <field name="region" xsi:type="searchable" dataType="varchar"/>
            <field name="telephone" xsi:type="searchable" dataType="varchar"/>

I run:

bin/magento indexer:reindex

and got this error:

 Customer Grid indexer process unknown error:
 SQLSTATE[42000]: Syntax error or access violation: 1070
 Too many key parts specified; max 16 parts allowed, query was:
 CREATE TABLE IF NOT EXISTS `customer_grid_flat`

How can I solve this? Maybe if I do not use billing data how can I remove it from indexer?

1 Answer 1


I think you can easily change with the just small change for shipping address,

<fieldset name="billing" source="Magento\Customer\Model\ResourceModel\Address\Collection"
    <reference fieldset="customer" from="entity_id" to="default_shipping"/>

Here you need to change the value to="default_shipping" from "default_billing"

And make your module depends on Magento_Customer , clear cache

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.