早上好,我有一个问题,请给我一个实用的代码答案。 我有两个表Orders和Locations 我想查询“纽约球”这样的查询,并希望从位置为23(纽约)的订单表中接收所有有关球的查询
我有这样的地图
$mapping = [
'index' =>'elastic',
'type'=>'order',
'body'=>[
'properties'=>[
'item_name' => [
'type' => 'text',
'analyzer' => "ngram_analyzer_with_filter",
],
'order_description' => [
'type' => 'text',
'analyzer' => "ngram_analyzer_with_filter",
],
'id' => [
'type' => 'text',
'analyzer' => "ngram_analyzer_with_filter",
],
'notes' => [
'type' => 'text',
'analyzer' => "ngram_analyzer_with_filter",
]
]
]
];
还有这样的查询构建器
$items = $this->search->search([
'index' => 'elastic',
'type' => 'order',
'body'=>[
'query'=>[
"multi_match"=>[
"fields"=>["item_name^5","location^4","order_description^3","notes^2"],
"query"=>$query
]
],
"highlight" => [
"pre_tags" => "<b style='color:#da4f49'>",
"post_tags" => "</b>",
"fields" => [
"item_name" => new \stdClass(),
"order_description"=> new \stdClass(),
"id" => new \stdClass(),
"notes" => new \stdClass()
]
]]]
);
请提供一个可以帮助我的代码,请将代码发送给我,因为我根本不理解该主题,而且我很难理解除代码以外的其他内容。感谢所有人当我尝试创建索引映射时
"location_name"=> [
"type"=> "join",
"relations"=>
["location"=> "order" ]
]
我收到一个错误,没有在字段[location_id]“}]上声明类型[join]的处理程序