我正在尝试获取按
updated_at
字段排序的索引的所有匹配项。
然而,下面显示的错误信息说明了这一点:
"{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [updated_at] in order to load fielddata in memory by uninverting the inverted index.
这是我正在使用的映射:
Map::create($this->getModelType(), function (Blueprint $map) {
$map->integer('id');
$map->addField('text', 'title');
$map->date('created_at')->format('yyyy-MM-dd HH:mm:ss');
$map->date('updated_at')->format('yyyy-MM-dd HH:mm:ss');
$map->date('deleted_at')->format('yyyy-MM-dd HH:mm:ss');
}));
这是获取所有通过 updated_at
字段排序的数据的代码:
$titleData = $this->title->search()->sortBy('updated_at', 'DESC');
有什么想法吗?