Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.78 KB | None | 0 0
  1. using Newtonsoft.Json;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Web;
  6.  
  7. namespace log_finder.Models
  8. {
  9. public class ElasticRequestDto
  10. {
  11. [JsonProperty("from")]
  12. public int From { get; set; }
  13. [JsonProperty("size")]
  14. public int Size { get; set; }
  15. [JsonProperty("sort")]
  16. public Sort[] Sort { get; set; }
  17. [JsonProperty("query")]
  18. public Query Query { get; set; }
  19. public ElasticRequestDto()
  20. {
  21.  
  22. }
  23.  
  24. public ElasticRequestDto(int from, int size)
  25. {
  26. From = from;
  27. Size = size;
  28. Sort = new Sort[] { new Sort { TimeStamp = new TimeStamp() } };
  29. Query = new Query();
  30. }
  31.  
  32. }
  33.  
  34. public class Sort
  35. {
  36. [JsonProperty("timestamp")]
  37. public TimeStamp TimeStamp { get; set; }
  38. }
  39.  
  40. public class TimeStamp
  41. {
  42. [JsonProperty("order")]
  43. public string Order { get; set; }
  44. public TimeStamp()
  45. {
  46. Order = "desc";
  47. }
  48. }
  49.  
  50. public class Query
  51. {
  52. [JsonProperty("bool")]
  53. public QueryBool QueryBool { get; set; }
  54. public Query()
  55. {
  56. QueryBool = new QueryBool();
  57. }
  58. }
  59.  
  60. public class QueryBool
  61. {
  62. [JsonProperty("must")]
  63. public List<Dictionary<string, Dictionary<string, Dictionary<string, string>>>> Must { get; set; }
  64. public QueryBool()
  65. {
  66. Must = new List<Dictionary<string, Dictionary<string, Dictionary<string, string>>>>
  67. {
  68. // list item
  69. new Dictionary<string, Dictionary<string, Dictionary<string, string>>>
  70. {
  71. // term
  72. ["term"] = new Dictionary<string, Dictionary<string, string>>
  73. {
  74. // facility
  75. ["facility"] = new Dictionary<string, string>
  76. {
  77. ["value"] = "doc_email_udp"
  78. }
  79. }
  80. },
  81. // list item
  82. new Dictionary<string, Dictionary<string, Dictionary<string, string>>>
  83. {
  84. // term
  85. ["term"] = new Dictionary<string, Dictionary<string, string>>
  86. {
  87. // appConfig
  88. ["appConfig"] = new Dictionary<string, string>
  89. {
  90. ["value"] = "Production"
  91. }
  92. }
  93. },
  94. // list item
  95. //new Dictionary<string, Dictionary<string, Dictionary<string, string>>>
  96. //{
  97. // // query_string
  98. // ["query_string"] = new Dictionary<string, Dictionary<string, string>>
  99. // {
  100. // //["fields"] = new List<string> { "message", "to" }
  101. // ["query"] = "bachurin@ERA-NN.RU"
  102. // }
  103. //},
  104. // list item
  105. new Dictionary<string, Dictionary<string, Dictionary<string, string>>>
  106. {
  107. // range
  108. ["range"] = new Dictionary<string, Dictionary<string, string>>
  109. {
  110. // appConfig
  111. ["timestamp"] = new Dictionary<string, string>
  112. {
  113. ["gte"] = "2017-03-20 06:00:04.789"
  114. }
  115. }
  116. }
  117. };
  118. }
  119. }
  120.  
  121. public class Must
  122. {
  123.  
  124. }
  125.  
  126. public class Term
  127. {
  128.  
  129. }
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement