public void Insert()
        {
            DeleteAndCreate(client, index);

            var person = new Person
            {
                Description = "Description",
                Name        = "Name"
            };

            var linkActor = new LinkActor
            {
                Actor = person
            };

            var actorAsJsonString = JsonConvert.SerializeObject(linkActor, new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            });

            var indexResponse = client.IndexDocument(JObject.Parse(actorAsJsonString));

            if (!indexResponse.IsValid)
            {
                throw new Exception("Error while inserting document: " + indexResponse.OriginalException);
            }
        }
예제 #2
0
        public void Insert()
        {
            DeleteAndCreate(client, index);

            var person = new Person
            {
                Description = "Description",
                Name        = "Name"
            };

            var linkActor = new LinkActor
            {
                Actor = person
            };

            var indexResponse = client.IndexDocument(linkActor);

            if (!indexResponse.IsValid)
            {
                throw new Exception("Error while inserting document: " + indexResponse.OriginalException);
            }
        }