Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort data #217

Open
parimahziaei opened this issue Apr 7, 2020 · 2 comments
Open

sort data #217

parimahziaei opened this issue Apr 7, 2020 · 2 comments

Comments

@parimahziaei
Copy link

hi
i am new in elastic search
whithin this package how can i sort an d pagination?
$ads = advertise::searchByQuery(array('match' => array('status' => '1')),null, null, 18, 0, ['created_at' => 'desc']);
i use this function but nothing happend
hepl me plz

@nasirsotudeh
Copy link

nasirsotudeh commented Apr 8, 2020

hi
I have this problem too. And I tested all kinds of methods and sorting didn't work.

$ads = advertise::searchByQuery([
    'bool' =>[
        'must'=>[
            'term'=>[
                'status'=>1,
            ]
        ]
    ],
    'sort'=>[
        'category_id'=>['order'=>'desc'],
    ]
]);

or this

            $query['bool']['must']= ['term' => ['status' =>1]];
            $query['bool']['sort']=['created_at'=>['order'=>'desc']];
            $ads = advertise::searchByQuery($query);

@JamieCee20
Copy link

Bump! I cannot find the solution either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants