Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace log_finder.Models
- {
- public class ElasticRequestDto
- {
- [JsonProperty("from")]
- public int From { get; set; }
- [JsonProperty("size")]
- public int Size { get; set; }
- [JsonProperty("sort")]
- public Sort[] Sort { get; set; }
- [JsonProperty("query")]
- public Query Query { get; set; }
- public ElasticRequestDto()
- {
- }
- public ElasticRequestDto(int from, int size)
- {
- From = from;
- Size = size;
- Sort = new Sort[] { new Sort { TimeStamp = new TimeStamp() } };
- Query = new Query();
- }
- }
- public class Sort
- {
- [JsonProperty("timestamp")]
- public TimeStamp TimeStamp { get; set; }
- }
- public class TimeStamp
- {
- [JsonProperty("order")]
- public string Order { get; set; }
- public TimeStamp()
- {
- Order = "desc";
- }
- }
- public class Query
- {
- [JsonProperty("bool")]
- public QueryBool QueryBool { get; set; }
- public Query()
- {
- QueryBool = new QueryBool();
- }
- }
- public class QueryBool
- {
- [JsonProperty("must")]
- public List<Dictionary<string, Dictionary<string, Dictionary<string, string>>>> Must { get; set; }
- public QueryBool()
- {
- Must = new List<Dictionary<string, Dictionary<string, Dictionary<string, string>>>>
- {
- // list item
- new Dictionary<string, Dictionary<string, Dictionary<string, string>>>
- {
- // term
- ["term"] = new Dictionary<string, Dictionary<string, string>>
- {
- // facility
- ["facility"] = new Dictionary<string, string>
- {
- ["value"] = "doc_email_udp"
- }
- }
- },
- // list item
- new Dictionary<string, Dictionary<string, Dictionary<string, string>>>
- {
- // term
- ["term"] = new Dictionary<string, Dictionary<string, string>>
- {
- // appConfig
- ["appConfig"] = new Dictionary<string, string>
- {
- ["value"] = "Production"
- }
- }
- },
- // list item
- //new Dictionary<string, Dictionary<string, Dictionary<string, string>>>
- //{
- // // query_string
- // ["query_string"] = new Dictionary<string, Dictionary<string, string>>
- // {
- // //["fields"] = new List<string> { "message", "to" }
- // ["query"] = "bachurin@ERA-NN.RU"
- // }
- //},
- // list item
- new Dictionary<string, Dictionary<string, Dictionary<string, string>>>
- {
- // range
- ["range"] = new Dictionary<string, Dictionary<string, string>>
- {
- // appConfig
- ["timestamp"] = new Dictionary<string, string>
- {
- ["gte"] = "2017-03-20 06:00:04.789"
- }
- }
- }
- };
- }
- }
- public class Must
- {
- }
- public class Term
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement