laravel - 求elasticsearch client php 搜索及排序方式方法

 书友32368660 发布于 2022-11-16 14:04

本人用的laravel调用 elasticsearch client 2.x

       $params = [
            'index' => 'aindex',
            'type' => 'atype',
            'body' => [
                'query' => [
                    'dis_max' => [
                        'queries' => [
                            [ 'match' => [ 'ntitle' => $word]],
                            [ 'match' => [ 'description' => $word]]
                        ]
                        ,'tie_breaker'=>0.3
                    ]
                ]
                //,'sort' => ['ndate'=>['order'=>'desc']]
                , 'from' => $fr, 'size' => $s

            ]
        ];
        $res = $this->client->search($params);

想了解以下问题:
一、都有哪些查询方法,主要针对多字段批配时,希望能举例说明。
二、为什么我查询时正常,但加上时间字段排序就出现好多重复的结果?求如何排序(按时间字段)查询结果

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有