// ByStatus .... This will be used by backend python model, search by open status
ByStatus .... This will be used by backend python model, search by open status
// ByStatus .... This will be used by backend python model search by open status
func ByStatus(context *gin.Context, elasticClient *elastic.Client, myStatusCode string) {
	skip := 0
	take := 10
	esQuery := elastic.NewMultiMatchQuery(myStatusCode, "statuscode").
		Fuzziness("2").
		MinimumShouldMatch("2")
	result, err := elasticClient.Search().
		Index(elasticIndexName).
		Query(esQuery).
		From(skip).Size(take).
		Do(context)
	if err != nil {
		log.Println(err)
		common.ErrorResponse(context, http.StatusInternalServerError, "Something went wrong")
		return
	}
	docs := make([]models.DocumentResponse, 0)
	for _, hit := range result.Hits.Hits {
		var doc models.DocumentResponse
		json.Unmarshal(*hit.Source, &doc)
		docs = append(docs, doc)
	}
	context.JSON(http.StatusOK, docs)
	return
}
func ByStatus ( context * gin . Context , elasticClient * elastic . Client , myStatusCode string ) { skip := 0 take := 10 esQuery := elastic . NewMultiMatchQuery ( myStatusCode , " " ) . Fuzziness ( " " ) . MinimumShouldMatch ( " " ) result , err := elasticClient . Search ( ) . Index ( elasticIndexName ) . Query ( esQuery ) . From ( skip ) . Size ( take ) . Do ( context ) if err != nil { log . Println ( err ) common . ErrorResponse ( context , http . StatusInternalServerError , " " ) return } docs := make ( [ ] models . DocumentResponse , 0 ) for _ , hit := range result . Hits . Hits { var doc models . DocumentResponse json . Unmarshal ( * hit . Source , & doc ) docs = append ( docs , doc ) } context . JSON ( http . StatusOK , docs ) return }
ByStatus ....
ByStatus ....
// Transform search results before returning them