Search/Query entities by ID
Posted: Wed Dec 11, 2019 2:38 pm
First time using the API and I've come across search/query behaviour which, to my newbie eyes, seems strange.
Specifying one or more "ID" values which I know match existing records, exhibits inconsistent responses.
I see similar results in the Candidate, JobSubmission and JobOrder entity endpoints but here is an example using the candidate endpoint and the POST method to define the query. That said, I get the same results when I use the GET method too.
I've detailed (redacted) request/responses below, my question is why the API does not return the matching records in every one of these requests?
Thanks for your help.
URL
search/Candidate?fields=id,firstName,lastName&count=100&start=1
Range Query (post body)
{"query": "id:[12685 TO 12693]"}
RESP
{"total":3,"start":1,"count":2,"data":[{"id":12686,"firstName":"XXXXX","lastName":"XXXXX","_score":1.0},
{"id":12692,"firstName":"XXXXX","lastName":"XXXXX","_score":1.0}]}
-- these are the 2 records I'm interested in
-- so I'll use an IN query...
IN Query (post body)
{"query": "id:12686 12692"}
RESP
{"total":2,"start":1,"count":1,"data":[{"id":12692,"firstName":"XXXXX","lastName":"XXXXX","_score":1.0}]}
-- neither records are returned?
-- I'll retry the range, bounded by the 2 ID's
Range Query (post body)
{"query": "id:[12686 TO 12692]"}
RESP
{"total":2,"start":1,"count":1,"data":[{"id":12692,"firstName":"XXXXX","lastName":"XXXXX","_score":1.0}]}
-- only one of the records are returned when I am expecting 2
-- specify the ID's separately
Query (post body)
{"query": "id:12686"}
{"query": "id:12692"}
RESP is the same for both POSTS
{"total":1,"start":1,"count":0,"data":[]}
Specifying one or more "ID" values which I know match existing records, exhibits inconsistent responses.
I see similar results in the Candidate, JobSubmission and JobOrder entity endpoints but here is an example using the candidate endpoint and the POST method to define the query. That said, I get the same results when I use the GET method too.
I've detailed (redacted) request/responses below, my question is why the API does not return the matching records in every one of these requests?
Thanks for your help.
URL
search/Candidate?fields=id,firstName,lastName&count=100&start=1
Range Query (post body)
{"query": "id:[12685 TO 12693]"}
RESP
{"total":3,"start":1,"count":2,"data":[{"id":12686,"firstName":"XXXXX","lastName":"XXXXX","_score":1.0},
{"id":12692,"firstName":"XXXXX","lastName":"XXXXX","_score":1.0}]}
-- these are the 2 records I'm interested in
-- so I'll use an IN query...
IN Query (post body)
{"query": "id:12686 12692"}
RESP
{"total":2,"start":1,"count":1,"data":[{"id":12692,"firstName":"XXXXX","lastName":"XXXXX","_score":1.0}]}
-- neither records are returned?
-- I'll retry the range, bounded by the 2 ID's
Range Query (post body)
{"query": "id:[12686 TO 12692]"}
RESP
{"total":2,"start":1,"count":1,"data":[{"id":12692,"firstName":"XXXXX","lastName":"XXXXX","_score":1.0}]}
-- only one of the records are returned when I am expecting 2
-- specify the ID's separately
Query (post body)
{"query": "id:12686"}
{"query": "id:12692"}
RESP is the same for both POSTS
{"total":1,"start":1,"count":0,"data":[]}