I am trying to make elasticSearch Post call within Angular 7 but it is throwing 400 bad error.
public elasticSearch<T>(): Observable<ElasticModel<T>> {
const reqBody = {
"query": {
"bool": {
"should": {
"match": {
"status": "IN_PROGRESS"
}
}
}
}
};
// tslint:disable-next-line:max-line-length
return this.http.get<ElasticResponseData<T>>(`${this.apiUri}/_search/query?indexName=` + 1 + `&query=` + JSON.stringify(reqBody) + `&size=` + 2 + `&from=` + (page - 1) * size);
// return this.http.get<ElasticResponseData<T>>(`${this.apiUri}/_search`);
}
I am able to make successful call though when not passing any params and making regular get call
return this.http.get<ElasticResponseData<T>>(`${this.apiUri}/_search`);