-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathDeleteByQueryRequestTests.cs
56 lines (51 loc) · 1.35 KB
/
DeleteByQueryRequestTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Elasticsearch.Net;
using FluentAssertions;
using Nest.Resolvers;
using Nest.Tests.MockData.Domain;
using NUnit.Framework;
namespace Nest.Tests.Unit.ObjectInitializer.DeleteByQuery
{
[TestFixture]
public class DeleteByQueryRequestTests : BaseJsonTests
{
private readonly IElasticsearchResponse _status;
public DeleteByQueryRequestTests()
{
QueryContainer query = new TermQuery()
{
Field = Property.Path<ElasticsearchProject>(p=>p.Name),
Value = "value"
} && new PrefixQuery()
{
Field = "prefix_field",
Value = "prefi",
Rewrite = RewriteMultiTerm.ConstantScoreBoolean
};
var request = new DeleteByQueryRequest()
{
AllIndices = true,
AllowNoIndices = true,
ExpandWildcards = ExpandWildcards.Closed,
Query = query,
DefaultOperator = DefaultOperator.And
};
var response = this._client.DeleteByQuery(request);
this._status = response.ConnectionStatus;
}
[Test]
public void Url()
{
this._status.RequestUrl.Should().EndWith("/_all/_query?allow_no_indices=true&expand_wildcards=closed&default_operator=AND");
this._status.RequestMethod.Should().Be("DELETE");
}
[Test]
public void DeleteByQueryBody()
{
this.JsonEquals(this._status.Request, MethodBase.GetCurrentMethod());
}
}
}