I want to run a phonograph aggregation query from the API and don't manage to set the pageSize.
When I run an aggregation query from Slate, I can set the pageSize Parameter to 0 which has the effect, that I get only the aggregation in the result.
Here the complete preview from Slate of my query:
{
"extractors": {
"result": "$"
},
"headers": {},
"method": "POST",
"path": "search/tables",
"pathParams": {},
"queryParams": {
"pageSize": 0
},
"bodyJson": {
"tableRids": [
"ri.phonograph2.main.table.xxxx"
],
"filter": {
"type": "and",
"and": []
},
"aggregations": {
"distincCrit": {
"terms": {
"field": "type.raw",
"order": {
"_term": "asc"
}
}
}
}
}
}
I want to perform this as well from the command-line in python. So I set up my code. The json-parameter is filled with the bodyJson from above.
response = requests.post(PHONOAPI_SEARCH_API, headers=HEADERS, json=searchAgg, verify=False, proxies=proxies).text
But I find no way to add the queryParams with the pageSize to my python Code.
Any suggestion?
I tried to add the pageSize Attribute to the json and the header without effect. I tried as well to pass the queryParams in the "data" parameter of the request but failed as well.
You should be able to pass the pageSize using requests params keyword arguments: