123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using Nest;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace XYY.Common.Standard
- {
- public class EsClientManager
- {
- public class ChargesLog
- {
- public string Number
- {
- get; set;
- }
- public long Millise
- {
- get; set;
- }
- public string Time
- {
- get; set;
- }
- public Dictionary<string, long> TimeList
- {
- get; set;
- }
- public long TimeLong
- {
- get; set;
- }
- }
- private readonly static object lockObj = null;
- static EsClientManager()
- {
- lockObj = new object();
- }
- private static ElasticClient _weightLogClient;
- public static ElasticClient WeightLogClient
- {
- get
- {
- if (_weightLogClient == null)
- {
- lock (lockObj)
- {
- if (_weightLogClient == null)
- {
- string addr = "http://120.24.149.148:9526";
- Uri node = new Uri(addr);
- var settings = new ConnectionSettings(node).DefaultMappingFor<ChargesLog>(x =>
- x.IndexName("chargeslog")
- .TypeName("log")
- .IdProperty(y => y.Number));
- _weightLogClient = new ElasticClient(settings);
- }
- }
- }
- return _weightLogClient;
- }
- }
- }
- }
|