Hits.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using Newtonsoft.Json;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace CoreEntity.ESEntity
  6. {
  7. public class EsCommon
  8. {
  9. /// <summary>
  10. /// JSON转对象
  11. /// </summary>
  12. /// <typeparam name="T"></typeparam>
  13. /// <param name="input"></param>
  14. /// <returns></returns>
  15. public static T FromJSON<T>(string input)
  16. {
  17. try
  18. {
  19. return JsonConvert.DeserializeObject<T>(input);
  20. }
  21. catch (Exception ex)
  22. {
  23. string a = ex.Message;
  24. return default(T);
  25. }
  26. }
  27. }
  28. public class Total
  29. {
  30. /// <summary>
  31. ///
  32. /// </summary>
  33. public int value { get; set; }
  34. /// <summary>
  35. ///
  36. /// </summary>
  37. public string relation { get; set; }
  38. }
  39. public class Hits<T>
  40. {
  41. /// <summary>
  42. ///
  43. /// </summary>
  44. public Total total { get; set; }
  45. /// <summary>
  46. ///
  47. /// </summary>
  48. public string max_score { get; set; }
  49. /// <summary>
  50. ///
  51. /// </summary>
  52. public List<HitsItem<T>> hits { get; set; }
  53. }
  54. }