graphql-compose-elasticsearch icon indicating copy to clipboard operation
graphql-compose-elasticsearch copied to clipboard

Error while doing sort on field for searchConnection method

Open appasahebs opened this issue 5 years ago • 1 comments

Error while doing sort on field for searchConnection method. Specially its not working with "date" type of fields.

Query postConnection(query: {bool: {must: [ {term: {type: {value: "type"}}}]}}, sort: [post_date__desc], first: 12, after: $after) {

Output  {"errors":[{"message":"Cannot read property 'join' of undefined","locations":[{"line":2,"column":3}],"path":["postConnection"]}],"data":{"postConnection":null}}

Please let me know if I am missing something.

appasahebs avatar Jun 29 '20 17:06 appasahebs

Not sure if you fixed this, but the sort has to return a unique cursor so if you had two posts with the same date it won't work, you'd have to use something like an id along with the date that way it will be a unique cursor.

liamraynor avatar Nov 02 '21 15:11 liamraynor