Skip to content

[8.0] Add tests for #87 and #88 (#126) #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ public void testDataIngestion() throws Exception {

assertEquals("my/Id", docId);

// Check auto-created mapping
GetMappingResponse mapping = client.indices().getMapping(b -> b.index(index));
assertEquals(
Property.Kind.Long,
mapping.get("ingest-test").mappings().properties().get("intValue")._kind()
);

// Query by id
AppData esData = client.get(b -> b
.index(index)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package co.elastic.clients.elasticsearch.spec_issues;

import co.elastic.clients.elasticsearch.ElasticsearchTestServer;
import co.elastic.clients.elasticsearch.cluster.ClusterStatsResponse;
import co.elastic.clients.elasticsearch.core.SearchRequest;
import co.elastic.clients.elasticsearch.core.SearchResponse;
import co.elastic.clients.elasticsearch.model.ModelTestCase;
Expand All @@ -43,6 +44,26 @@ public void i0107_rangeBucketKey() {
loadRsrc("issue-0107-response.json", SearchResponse.createSearchResponseDeserializer(JsonData._DESERIALIZER));
}

@Test
public void i0088_clusterStats() {
// https://github.com/elastic/elasticsearch-java/issues/88
loadRsrc("issue-0088-response.json", ClusterStatsResponse._DESERIALIZER);
}

@Test
public void i0087_filterAggSubAggregation() {
// https://github.com/elastic/elasticsearch-java/issues/87
SearchResponse<JsonData> resp = loadRsrc("issue-0087-response.json",
SearchResponse.createSearchResponseDeserializer(JsonData._DESERIALIZER));

assertEquals(
"cnn.com",
resp.aggregations().get("login_filter").filter()
.aggregations().get("to_domain").sterms()
.buckets().array().get(0).key());

}

@Test
public void i0078_deserializeSearchRequest() {
// https://github.com/elastic/elasticsearch-java/issues/78
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
"_source": {
"excludes": [
"attachmentContents.*"
],
"includes": [
"*"
]
},
"aggregations": {
"count": {
"value_count": {
"field": "messageStorageId.messageId"
}
},
"login_filter": {
"aggregations": {
"date": {
"terms": {
"field": "year",
"order": [
{
"_key": "desc"
}
]
}
},
"to_domain": {
"terms": {
"exclude": [
"unknown"
],
"field": "to.domain"
}
},
"file_ext": {
"terms": {
"exclude": [
""
],
"field": "attachments.fileExt"
}
},
"has_att": {
"terms": {
"field": "hasAttachments"
}
},
"from": {
"terms": {
"exclude": [
"unknown"
],
"field": "sender.name"
}
},
"from_domain": {
"terms": {
"exclude": [
"unknown"
],
"field": "sender.domain"
}
},
"to": {
"terms": {
"exclude": [
"unknown"
],
"field": "to.name"
}
}
},
"filter": {
"bool": {
"must": [
{
"bool": {
"minimum_should_match": "1"
}
}
]
}
}
}
},
"from": 0,
"highlight": {
"fields": {
"body": {
"fragment_size": 0,
"number_of_fragments": 0
},
"attachments.fileName": {
"fragment_size": 0,
"number_of_fragments": 0
},
"attachmentContents.*": {
"fragment_size": 200,
"number_of_fragments": 2
},
"subject": {
"fragment_size": 0,
"number_of_fragments": 0
}
},
"post_tags": [
"</span>"
],
"pre_tags": [
"<span class=\"blue-hilite\">"
]
},
"query": {
"bool": {
"must": [
{
"bool": {
"must": [
{
"query_string": {
"default_operator": "and",
"query": "Tsang"
}
}
]
}
},
{
"bool": {
"minimum_should_match": "1",
"should": [
{
"match_all": {}
}
]
}
}
]
}
},
"size": 10,
"sort": [
{
"messageDate": {
"order": "asc"
}
}
],
"stored_fields": [
"_source"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"took": 190,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": null,
"hits": []
},
"aggregations": {
"value_count#count": {
"value": 1
},
"filter#login_filter": {
"meta": {},
"doc_count": 1,
"sterms#to_domain": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "cnn.com",
"doc_count": 1
}
]
},
"sterms#date": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "2008",
"doc_count": 1
}
]
},
"lterms#has_att": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 1,
"key_as_string": "true",
"doc_count": 1
}
]
},
"sterms#file_ext": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "doc",
"doc_count": 1
}
]
},
"sterms#from_domain": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "gmail.com",
"doc_count": 1
}
]
},
"sterms#from": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "John Tsang",
"doc_count": 1
}
]
},
"sterms#to": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "John Smith",
"doc_count": 1
}
]
}
}
}
}
Loading