My query result will change in same params


(Jianfeng Ye) #1

my query params like that

$params = [
            'index' => "questions",
            'type' => "baichebao",
            'body' => [
                'from' => $from,
                'size' => 1,
                'sort' => [
                    "_score" => 'desc',
                ],
                'query' => [
                    'filtered' => [
                        "query" => [
                            "match" => [
                                'content' => '我的斯巴鲁启动不了了'
                            ]
                        ]
                    ]
                ]
            ]
        ];

but when I query twice, I got diffrent result:

one is

{
    "code": 0,
    "message": "处理成功",
    "timestamp": 1442186044,
    "im": true,
    "result": {
        "took": 16,
        "timed_out": false,
        "_shards": {
            "total": 5,
            "successful": 5,
            "failed": 0
        },
        "hits": {
            "total": 119124,
            "max_score": 3.9808903,
            "hits": [
                {
                    "_index": "questions",
                    "_type": "baichebao",
                    "_id": "901543",
                    "_score": 3.9808903,
                    "_source": {
                        "id": 901543,
                        "content": "斯巴鲁新车启动冒烟",
                        "uid": 1,
                        "all_answer_count": 0,
                        "answer_users": 0,
                        "best_answer": 0,
                        "status": 1,
                        "is_closed": false,
                        "tags": [],
                        "channel_type": 6,
                        "channel_sub_type": 0,
                        "created_at": 1430748122,
                        "distrust": 0,
                        "is_expert": false,
                        "series_id": 0
                    }
                }
            ]
        }
    }
}

the other one is:

{
    "code": 0,
    "message": "处理成功",
    "timestamp": 1442186188,
    "im": true,
    "result": {
        "took": 17,
        "timed_out": false,
        "_shards": {
            "total": 5,
            "successful": 5,
            "failed": 0
        },
        "hits": {
            "total": 255033,
            "max_score": 3.4157248,
            "hits": [
                {
                    "_index": "questions",
                    "_type": "baichebao",
                    "_id": "2229710",
                    "_score": 3.4157248,
                    "_source": {
                        "id": 2229710,
                        "content": "斯巴鲁翼豹一键启动困难",
                        "uid": 1,
                        "all_answer_count": 1,
                        "answer_users": 1,
                        "best_answer": 0,
                        "status": 1,
                        "is_closed": false,
                        "tags": [],
                        "channel_type": 6,
                        "channel_sub_type": 0,
                        "created_at": 1439695773,
                        "distrust": 0,
                        "is_expert": false,
                        "series_id": 0
                    }
                }
            ]
        }
    }
}

By the way, I have two node in my cluster, but I saw green in the head, It is strange right? does it mean my cluster builded wrong?


script_score return is strange
(Mark Walkom) #2

Is this related to script_score return is strange?


(Jianfeng Ye) #3

Yes, the two question is in same index, and i solve this question by rebuild index, but i do not know the solution for question "script_score return is strange"


(system) #4