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

When using esb.sort().script(...) #78

Merged
merged 13 commits into from
Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/core/sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const invalidUnitParam = invalidParam(ES_REF_URL, 'unit', UNIT_SET);
* .query(esb.termQuery('user', 'kimchy'))
* .sort(esb.sort('post_date', 'asc'))
*
* @param {string} field The field to sort on
* @param {string=} field The field to sort on.
* If a script is used to specify the sort order, `field` should be omitted.
* @param {string=} order The `order` option can have the following values.
* `asc`, `desc` to sort in ascending, descending order respectively.
*/
Expand Down
12 changes: 7 additions & 5 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8258,13 +8258,14 @@ declare namespace esb {
/**
* Allows creating and configuring sort on specified field.
*
* @param {string} field The field to sort on
* @param {string=} field The field to sort on.
* If a script is used to specify the sort order, `field` should be omitted.
* @param {string=} order The `order` option can have the following values.
* `asc`, `desc` to sort in ascending, descending order respectively.
*/
export class Sort {
constructor(field: string, order?: string);

constructor(field?: string, order?: string);
/**
* Set order for sorting. The order defaults to `desc` when sorting on the `_score`,
* and defaults to `asc` when sorting on anything else.
Expand Down Expand Up @@ -8417,11 +8418,12 @@ declare namespace esb {
/**
* Allows creating and configuring sort on specified field.
*
* @param {string} field The field to sort on
* @param {string=} field The field to sort on.
* If a script is used to specify the sort order, `field` should be omitted.
* @param {string=} order The `order` option can have the following values.
* `asc`, `desc` to sort in ascending, descending order respectively.
*/
export function sort(field: string, order?: string): Sort;
export function sort(field?: string, order?: string): Sort;

/**
* A `rescore` request can help to improve precision by reordering just
Expand Down