Currently able to GET and POST to my collection but need the ability for more complicated queries, I am using bodybuilder to structure the request and axios as my client.
However using POST doesn't return my specified results instead just the first 10 items in my index and using GET I'm unable to send a body for these complicated requests leaving me with POST.
I've switched setting my data from data:data to body:data with the same result.
Currently this is my POST which again returns data but NOT my filtered data just the first 10 items of my collection.
Any insight would be appreciated!
export function searchQuery(search: string) {
var body = bodybuilder().query("query_string", "query", search).build();
const data = JSON.stringify(body);
axios({
url: `${SEARCH_URL}`,
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: data,
}).then((res) => {
console.log(res);
});
}
This is my current log of data:
{"query":{"query_string":{"query":"Green"}}}