Skip to content

Commit

Permalink
Merge branch 'main' into inference_metadata_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikep86 committed Dec 17, 2024
2 parents e80fca1 + 9c3d6ca commit 9533c7b
Show file tree
Hide file tree
Showing 20 changed files with 247 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
"compatibilityChangeArea": {
"type": "string",
"enum": [
"Aggregations",
"Analysis",
"Authorization",
"Cluster and node setting",
Expand Down
5 changes: 0 additions & 5 deletions docs/changelog/116358.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions docs/changelog/117153.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions docs/changelog/118380.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions docs/changelog/118484.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pr: 118484
summary: Remove date histogram boolean support
area: Aggregations
type: breaking
issues: []
breaking:
title: Remove date histogram boolean support
area: Aggregations
details: Elasticsearch no longer allows running Date Histogram aggregations
over boolean fields. Instead, use Terms aggregation for boolean
fields.
impact: We expect the impact to be minimal, as this never produced good
results, and has been deprecated for years.
notable: false
6 changes: 6 additions & 0 deletions docs/changelog/118681.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 118681
summary: '`ConnectTransportException` returns retryable BAD_GATEWAY'
area: Network
type: enhancement
issues:
- 118320
6 changes: 6 additions & 0 deletions docs/changelog/118697.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 118697
summary: Esql implicit casting for date nanos
area: ES|QL
type: enhancement
issues:
- 118476
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ normal priority deployments.
Controls how many inference requests are allowed in the queue at a time.
Every machine learning node in the cluster where the model can be allocated
has a queue of this size; when the number of requests exceeds the total value,
new requests are rejected with a 429 error. Defaults to 1024. Max allowed value
is 1000000.
new requests are rejected with a 429 error. Defaults to 10000. Max allowed value
is 100000.

`threads_per_allocation`::
(Optional, integer)
Expand Down Expand Up @@ -173,7 +173,7 @@ The API returns the following results:
"model_bytes": 265632637,
"threads_per_allocation" : 1,
"number_of_allocations" : 1,
"queue_capacity" : 1024,
"queue_capacity" : 10000,
"priority": "normal"
},
"routing_table": {
Expand Down Expand Up @@ -229,4 +229,4 @@ POST _ml/trained_models/my_model/deployment/_start?deployment_id=my_model_for_se
}
}
--------------------------------------------------
// TEST[skip:TBD]
// TEST[skip:TBD]
3 changes: 3 additions & 0 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ tests:
- class: org.elasticsearch.index.engine.RecoverySourcePruneMergePolicyTests
method: testPruneSome
issue: https://github.com/elastic/elasticsearch/issues/118728
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
method: test {yaml=reference/indices/shard-stores/line_150}
issue: https://github.com/elastic/elasticsearch/issues/118896

# Examples:
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.common.Rounding;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.aggregations.Aggregator;
Expand Down Expand Up @@ -42,49 +41,6 @@ public static void registerAggregators(ValuesSourceRegistry.Builder builder) {
);

builder.register(DateHistogramAggregationBuilder.REGISTRY_KEY, CoreValuesSourceType.RANGE, DateRangeHistogramAggregator::new, true);

builder.register(
DateHistogramAggregationBuilder.REGISTRY_KEY,
CoreValuesSourceType.BOOLEAN,
(
name,
factories,
rounding,
order,
keyed,
minDocCount,
downsampledResultsOffset,
extendedBounds,
hardBounds,
valuesSourceConfig,
context,
parent,
cardinality,
metadata) -> {
DEPRECATION_LOGGER.warn(
DeprecationCategory.AGGREGATIONS,
"date-histogram-boolean",
"Running DateHistogram aggregations on [boolean] fields is deprecated"
);
return DateHistogramAggregator.build(
name,
factories,
rounding,
order,
keyed,
minDocCount,
downsampledResultsOffset,
extendedBounds,
hardBounds,
valuesSourceConfig,
context,
parent,
cardinality,
metadata
);
},
true
);
}

private final DateHistogramAggregationSupplier aggregatorSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.rest.RestStatus;

import java.io.IOException;

Expand Down Expand Up @@ -41,6 +42,18 @@ public ConnectTransportException(StreamInput in) throws IOException {
}
}

/**
* The ES REST API is a gateway to a single or multiple clusters. If there is an error connecting to other servers, then we should
* return a 502 BAD_GATEWAY status code instead of the parent class' 500 INTERNAL_SERVER_ERROR. Clients tend to retry on a 502 but not
* on a 500, and retrying may help on a connection error.
*
* @return a {@link RestStatus#BAD_GATEWAY} code
*/
@Override
public final RestStatus status() {
return RestStatus.BAD_GATEWAY;
}

@Override
protected void writeTo(StreamOutput out, Writer<Throwable> nestedExceptionsWriter) throws IOException {
super.writeTo(out, nestedExceptionsWriter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ public void testConnectTransportException() throws IOException {
ex = serialize(new ConnectTransportException(node, "msg", "action", new NullPointerException()));
assertEquals("[][" + transportAddress + "][action] msg", ex.getMessage());
assertThat(ex.getCause(), instanceOf(NullPointerException.class));
assertEquals(RestStatus.BAD_GATEWAY, ex.status());
}

public void testSearchPhaseExecutionException() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ public class DateHistogramAggregatorTests extends DateHistogramAggregatorTestCas
"2017-12-12T22:55:46"
);

public void testBooleanFieldDeprecated() throws IOException {
public void testBooleanFieldUnsupported() throws IOException {
final String fieldName = "bogusBoolean";
testCase(iw -> {
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> testCase(iw -> {
Document d = new Document();
d.add(new SortedNumericDocValuesField(fieldName, 0));
iw.addDocument(d);
Expand All @@ -95,8 +95,8 @@ public void testBooleanFieldDeprecated() throws IOException {
new DateHistogramAggregationBuilder("name").calendarInterval(DateHistogramInterval.HOUR).field(fieldName),
new BooleanFieldMapper.BooleanFieldType(fieldName)
)
);
assertWarnings("Running DateHistogram aggregations on [boolean] fields is deprecated");
));
assertThat(e.getMessage(), equalTo("Field [bogusBoolean] of type [boolean] is not supported for aggregation [date_histogram]"));
}

public void testMatchNoDocs() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@
},
"dynamic_templates" : [
{
"strings_as_keywords" : {
"map_objects": {
"match_mapping_type": "object",
"mapping": {
"type": "object"
}
}
},
{
"non_objects_as_keywords" : {
"match" : "*",
"mapping" : {
"type" : "keyword"
Expand Down
Loading

0 comments on commit 9533c7b

Please sign in to comment.