[Angular7中的ElasticSearch Post调用引发400个错误]] << [

问题描述 投票:0回答:1
我正在尝试在Angular 7中进行elasticSearch Post调用,但它抛出400错误错误。

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`); }

尽管不传递任何参数并进行常规get call时,我仍然可以成功拨打电话>

return this.http.get<ElasticResponseData<T>>(`${this.apiUri}/_search`);

我试图在Angular 7中进行elasticSearch Post调用,但它抛出400错误。 public elasticSearch 

():Observable > {const reqBody = {“ ...

angular elasticsearch datatable angular-material angular-datatables
1个回答
0
投票
您要发送的JSON查询应在HTTP请求的

body中发送。您正在通过URL

© www.soinside.com 2019 - 2024. All rights reserved.