TP-5555 | search addition
This commit is contained in:
@@ -81,8 +81,6 @@ func (el *ElasticSearchClient) SearchDocuments(searchRequest string, fields []st
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("%s", aggregations)
|
||||
|
||||
return results, aggregations, res.Hits.Total.Value, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
"net/http"
|
||||
)
|
||||
@@ -120,7 +119,7 @@ func (exceptionService *ExceptionService) CatchErrors(c *gin.Context) {
|
||||
|
||||
//ensure we are processing a valid payload
|
||||
if len(lines) <= 2 {
|
||||
exceptionService.logger.Error("payload is not valid", zap.Strings("payload", lines))
|
||||
//exceptionService.logger.Error("payload is not valid", zap.Strings("payload", lines))
|
||||
c.JSON(http.StatusOK, gin.H{"status": "payload is not valid"})
|
||||
return
|
||||
}
|
||||
@@ -145,6 +144,7 @@ func (exceptionService *ExceptionService) CatchErrors(c *gin.Context) {
|
||||
err := exceptionService.kafkaProducer.PublishEvent(errorItem, exceptionService.kafkaConfig.Topic, "", nil, encoder.JsonEncoderInstance)
|
||||
|
||||
if err != nil {
|
||||
exceptionService.logger.Error("Error publishing exception to Kafka: " + err.Error())
|
||||
fmt.Println("Failed to push error to kafka")
|
||||
}
|
||||
}
|
||||
|
||||
14
service/package.json
Normal file
14
service/package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "service",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/navi-ppl/cybertron.git"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
@@ -74,11 +74,14 @@ func (s *SearchService) GetSearchResults(c *gin.Context) {
|
||||
size_query := utils.CreateSizeQuery(int64(sizeInNumber))
|
||||
|
||||
term_query := utils.CreateTermSubQuery("project_id", projectId)
|
||||
multiMatchQuery := utils.CreateMultiMatchQuery(search_key, "error", "title", "extra.metadata")
|
||||
multiMatchQuery := utils.CreateMultiMatchQuery(search_key, "error", "title", "extra.metadata.agentId",
|
||||
"extra.metadata.external_customer_id",
|
||||
"extra.metadata.deviceId",
|
||||
"extra.metadata.web_session_id", "extra.metadata.id")
|
||||
should_query := utils.CreateMustQuery(term_query, multiMatchQuery)
|
||||
boolQuery := utils.CreateBoolQuery(should_query)
|
||||
search_query := utils.CreateSearchQuery(boolQuery)
|
||||
source_query := utils.CreateSourceQuery("error")
|
||||
source_query := utils.CreateSourceQuery("error", "error_hash", "created_at")
|
||||
finalQuery := utils.CreateEsQuery(source_query, search_query, size_query)
|
||||
fields := []string{"error", "significant_stack", "title"}
|
||||
var res, _, total, err = s.elasticSearchClient.SearchDocuments(finalQuery, fields)
|
||||
|
||||
Reference in New Issue
Block a user