How to index created field in baseFieldDefinition? because we have a lot of query on created date field on our custom Entity, we looking for a solution to index 'created' field index in Mysql.

this is our baseFieldDefinition : 

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);

$fields['product_id'] = BaseFieldDefinition::create('entity_reference')
  -&gt;setLabel(t('Product Category'))
  -&gt;setDescription(t('Product Category ref'))
  -&gt;setRevisionable(FALSE)
  -&gt;setSetting('target_type', 'taxonomy_term');

$fields['site_id'] = BaseFieldDefinition::create('entity_reference')
  -&gt;setLabel(t('Site ID Ref'))
  -&gt;setDescription(t('Site Category ref'))
  -&gt;setRevisionable(FALSE)
  -&gt;setSetting('target_type', 'taxonomy_term');


$fields['price'] = BaseFieldDefinition::create('integer')
  -&gt;setLabel(t('Price'))
  -&gt;setDescription(t('The Price of the Crawl entity entity.'))
  -&gt;setDefaultValue(0);

$fields['created'] = BaseFieldDefinition::create('created')
  -&gt;setLabel(t('Created'))
  -&gt;setDescription(t('The time that the entity was created.'));

return $fields;


}



is there any setting or method in ContentEntityBase to set a field indexable in Mysql?  

NOTE: we can index it with a simple migration in our module installer but first of it I'm curious about it, is there any solution to achieve it in BaseFieldDefinition?
The way to do that at the moment is a custom storage schema handler, see NodeStorageSchema for example:

protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) {
  $schema = parent::getEntitySchema($entity_type, $reset);

  $schema['node_field_data']['indexes'] += [
    'node__frontpage' =&gt; ['promote', 'status', 'sticky', 'created'],
    'node__title_type' =&gt; ['title', ['type', 4]],
  ];

  return $schema;
}


And then you register it with:

"storage_schema" = "Drupal\node\NodeStorageSchema",


as a handler.

To update existing installations, you need to drun drush entup or write an update function.