Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Changes to support IP field in star tree indexing([#16641](https://github.com/opensearch-project/OpenSearch/pull/16641/))
- Support object fields in star-tree index([#16728](https://github.com/opensearch-project/OpenSearch/pull/16728/))
- Support searching from doc_value using termQueryCaseInsensitive/termQuery in flat_object/keyword field([#16974](https://github.com/opensearch-project/OpenSearch/pull/16974/))
- Added a new `time` field to replace the deprecated `getTime` field in `GetStats`. ([#17009](https://github.com/opensearch-project/OpenSearch/pull/17009))

### Dependencies
- Bump `com.google.cloud:google-cloud-core-http` from 2.23.0 to 2.47.0 ([#16504](https://github.com/opensearch-project/OpenSearch/pull/16504))
Expand Down Expand Up @@ -73,7 +74,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### Deprecated
- Performing update operation with default pipeline or final pipeline is deprecated ([#16712](https://github.com/opensearch-project/OpenSearch/pull/16712))

- Marked `getTime` field as deprecated in favor of the new `time` field. ([#17009](https://github.com/opensearch-project/OpenSearch/pull/17009))
### Removed

### Fixed
Expand All @@ -97,7 +98,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fix Shallow copy snapshot failures on closed index ([#16868](https://github.com/opensearch-project/OpenSearch/pull/16868))
- Fix multi-value sort for unsigned long ([#16732](https://github.com/opensearch-project/OpenSearch/pull/16732))
- The `phone-search` analyzer no longer emits the tel/sip prefix, international calling code, extension numbers and unformatted input as a token ([#16993](https://github.com/opensearch-project/OpenSearch/pull/16993))

- Fix `GetStats` field serialization where `getTime` is used instead of `time` ([#17008](https://github.com/opensearch-project/OpenSearch/pull/17009))
### Security

[Unreleased 2.x]: https://github.com/opensearch-project/OpenSearch/compare/2.18...2.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
setup:
- do:
indices.create:
index: test1
body:
settings:
number_of_shards: 1
number_of_replicas: 0
wait_for_active_shards: all

- do:
index:
index: test1
id: 1
body: { "foo": "bar" }

- do:
indices.refresh:
index: test1

---
"Test _stats API includes both time and getTime metrics with human filter":
- skip:
version: " - 2.19.99"
reason: "this change is added in 3.0.0"

- do:
indices.stats:
metric: [ get ]
human: true

- is_true: _all.primaries.get.time
- is_true: _all.primaries.get.getTime
- match: { _all.primaries.get.time: "0s" }
- match: { _all.primaries.get.getTime: "0s" }
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.opensearch.core.xcontent.XContentBuilder;

import java.io.IOException;
import java.util.Objects;

/**
* Stats for a search get
Expand Down Expand Up @@ -137,6 +138,7 @@ public long current() {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(Fields.GET);
builder.field(Fields.TOTAL, getCount());
builder.field(Fields.GET_TIME, Objects.toString(getTime()));
builder.humanReadableField(Fields.TIME_IN_MILLIS, Fields.TIME, getTime());
builder.field(Fields.EXISTS_TOTAL, existsCount);
builder.humanReadableField(Fields.EXISTS_TIME_IN_MILLIS, Fields.EXISTS_TIME, getExistsTime());
Expand All @@ -155,7 +157,12 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
static final class Fields {
static final String GET = "get";
static final String TOTAL = "total";
static final String TIME = "getTime";
/**
* Deprecated field name for time. Use {@link #TIME} instead.
*/
@Deprecated(forRemoval = true)
static final String GET_TIME = "getTime";
static final String TIME = "time";
static final String TIME_IN_MILLIS = "time_in_millis";
static final String EXISTS_TOTAL = "exists_total";
static final String EXISTS_TIME = "exists_time";
Expand Down
Loading