Esempio n. 1
0
        public UploadDocumentsResponse DeleteSingleConnectRecordInAwsCloudsearch(int participantId, int pinType)
        {
            var cloudSearch = new AmazonCloudSearchDomainClient(AwsAccessKeyId, AwsSecretAccessKey, AmazonSearchUrl);

            var results    = SearchConnectAwsCloudsearch($"(and participantid:{participantId} pintype:{pinType})", "_no_fields");
            var deletelist = new List <AwsCloudsearchDto>();

            foreach (var hit in results.Hits.Hit)
            {
                var deleterec = new AwsCloudsearchDto
                {
                    id   = hit.Id,
                    type = "delete"
                };
                deletelist.Add(deleterec);
            }
            // serialize
            var json = JsonConvert.SerializeObject(deletelist, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            });
            var ms     = new MemoryStream(Encoding.UTF8.GetBytes(json));
            var upload = new UploadDocumentsRequest()
            {
                ContentType = ContentType.ApplicationJson,
                Documents   = ms
            };

            return(cloudSearch.UploadDocuments(upload));
        }
Esempio n. 2
0
        public void UploadNewPinToAws(PinDto pin)
        {
            var cloudSearch = new AmazonCloudSearchDomainClient(AwsAccessKeyId, AwsSecretAccessKey, AmazonSearchUrl);
            var upload      = GetObjectToUploadToAws(pin);

            cloudSearch.UploadDocuments(upload);
        }
Esempio n. 3
0
        public UploadDocumentsResponse UploadAllConnectRecordsToAwsCloudsearch()
        {
            var cloudSearch = new AmazonCloudSearchDomainClient(AwsAccessKeyId, AwsSecretAccessKey, AmazonSearchUrl);

            var pinList = GetDataForCloudsearch();

            //serialize
            var json = JsonConvert.SerializeObject(pinList, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            });
            var ms     = new MemoryStream(Encoding.UTF8.GetBytes(json));
            var upload = new UploadDocumentsRequest()
            {
                ContentType = ContentType.ApplicationJson,
                Documents   = ms
            };

            return(cloudSearch.UploadDocuments(upload));
        }