TP-55555 | fix es query for pagination

This commit is contained in:
varnit-goyal_navi
2024-09-10 10:19:01 +05:30
parent f55ab1e53f
commit 8283d62d3c
2 changed files with 23 additions and 2 deletions

View File

@@ -65,7 +65,11 @@ func (s *SearchService) GetErrorDetails(c *gin.Context) {
searchRequestformatted := es_query
fields := []string{"error", "significant_stack", "title"}
var response, _, total, _ = s.elasticSearchClient.SearchDocuments(searchRequestformatted, fields)
response, _, total, err := s.elasticSearchClient.SearchDocuments(searchRequestformatted, fields)
if err != nil {
utils.ErrorResponse(c, "Failed to search please try again later")
}
c.JSON(http.StatusOK, gin.H{
"results": response,
"total": total,
@@ -152,7 +156,7 @@ func (s *SearchService) GetErrorList(c *gin.Context) {
var _, aggs, total, err = s.elasticSearchClient.SearchDocuments(final_query, fields)
if err != nil {
c.JSON(http.StatusVariantAlsoNegotiates, "something went wrong ")
utils.ErrorResponse(c, "search failed please try again")
return
}