Exemple #1
0
        public async Task <IDeleteByQueryResponse> DeleteByAsync(string field, string equalsValue)
        {
            Log.Verbose($"Deleting elastic document with {field} = {equalsValue}");

            var query = new QueryContainer(
                new TermQuery
            {
                Field = field,
                Value = equalsValue
            });

            var doc = new Nest
                      .DocumentPath <dynamic>(query)
                      .Index(this.index)
                      .Type(this.type);

            var resp = await this.HighClient.DeleteByQueryAsync <dynamic>(q => q
                                                                          .Index(this.index)
                                                                          .Type(this.type)
                                                                          .Query(rq => rq
                                                                                 .Term(field, equalsValue)
                                                                                 )
                                                                          );

            return(resp);
        }
Exemple #2
0
        public async Task DeleteByIdAsync(string id)
        {
            Log.Verbose($"Deleting elastic document: {id}");
            var doc = new Nest
                      .DocumentPath <dynamic>(new Nest.Id(id))
                      .Index(this.index)
                      .Type(this.type);

            Nest.IDeleteResponse resp = await this.HighClient.DeleteAsync <dynamic>(doc);
        }