Closed eklem closed 7 years ago
Yes it should take the exact same query. Investigating...
Its because totalHits
expects an Array. So
http://oppskrift.klemespen.com:3030/totalHits?q=[{"query":{"AND":{"Varenavn":["eple"]}}}]
...works
http://oppskrift.klemespen.com:3030/totalHits?q={"query":{"AND":{"Varenavn":["eple"]}}} should also work though- need to fix
Wohooo! Works like a charm. And nice that it doesn't error on additonal stuff like pageSize. I'll make an issue on accepting the short-version of the q-object.
I was guessing that /totalHits would take the same q.query as input as the /search endpoint. That seems to not be the case:
My search query: http://oppskrift.klemespen.com:3030/search?q={"query":{"AND":{"*":["eple"]}}}
The totalHits q/count query: http://oppskrift.klemespen.com:3030/totalHits?q={"query":{"AND":{"Varenavn":["eple"]}}} http://oppskrift.klemespen.com:3030/totalHits?count={"query":{"AND":{"Varenavn":["eple"]}}}
First /totalHits-query gives me an error:
Second /totalHits-query gives me the same as docCount - the total amount of docs in the index, but as an object.
search-index API for totalHits: https://github.com/fergiemcdowall/search-index/blob/7faf44f328e87c6c5bed0ada9d90d552db195d10/doc/API.md#totalhits