mapping des dates pour sorting correct via elastic search

This commit is contained in:
Olivier Legat 2022-01-19 15:52:52 +01:00
parent 4f722589ae
commit c6f2b92e05
2 changed files with 13 additions and 6 deletions

View file

@ -47,11 +47,16 @@ class reindexElasticMedia extends Command
} else {
$startFrom = 1;
}
if (Media::indexExists() && !$bReprise)
$this->info('Test Présence...');
if (Media::indexExists() && !$bReprise) {
$this->info('Suppression index...');
Media::deleteIndex();
}
if(!$bReprise)
if(!$bReprise) {
$this->info('Création...');
Media::createIndex();
}
$medias = Media::all();
$bar = $this->output->createProgressBar(count($medias));

View file

@ -94,12 +94,14 @@ class Media extends Model
'fielddata' => true
),
'created_at' => array(
'type' => 'text',
'fielddata' => true
'type' => 'date',
"format" => "yyyy-MM-dd HH:mm:ss",
//'fielddata' => true
),
'updated_at' => array(
'type' => 'text',
'fielddata' => true
'type' => 'date',
"format" => "yyyy-MM-dd HH:mm:ss",
//'fielddata' => true
),
'version' => array(
'type' => 'text',