Skip to content
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

Deprecate _field_stats endpoint #23914

Merged
merged 1 commit into from
Apr 10, 2017
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
12 changes: 12 additions & 0 deletions core/src/main/java/org/elasticsearch/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,22 @@ public interface Client extends ElasticsearchClient, Releasable {
*/
void clearScroll(ClearScrollRequest request, ActionListener<ClearScrollResponse> listener);

/**
* @deprecated Use _field_caps instead or run a min/max aggregations on the desired fields
*/
@Deprecated
FieldStatsRequestBuilder prepareFieldStats();

/**
* @deprecated Use _field_caps instead or run a min/max aggregations on the desired fields
*/
@Deprecated
ActionFuture<FieldStatsResponse> fieldStats(FieldStatsRequest request);

/**
* @deprecated Use _field_caps instead or run a min/max aggregations on the desired fields
*/
@Deprecated
void fieldStats(FieldStatsRequest request, ActionListener<FieldStatsResponse> listener);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,19 @@
public class RestFieldStatsAction extends BaseRestHandler {
public RestFieldStatsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_field_stats", this);
controller.registerHandler(POST, "/_field_stats", this);
controller.registerHandler(GET, "/{index}/_field_stats", this);
controller.registerHandler(POST, "/{index}/_field_stats", this);
controller.registerAsDeprecatedHandler(GET, "/_field_stats", this,
deprecationMessage(), deprecationLogger);
controller.registerAsDeprecatedHandler(POST, "/_field_stats", this,
deprecationMessage(), deprecationLogger);
controller.registerAsDeprecatedHandler(GET, "/{index}/_field_stats", this,
deprecationMessage(), deprecationLogger);
controller.registerAsDeprecatedHandler(POST, "/{index}/_field_stats", this,
deprecationMessage(), deprecationLogger);
}

static String deprecationMessage() {
return "[_field_stats] endpoint is deprecated! Use [_field_caps] instead or " +
"run a min/max aggregations on the desired fields.";
}

@Override
Expand Down
9 changes: 9 additions & 0 deletions docs/reference/search/field-stats.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

experimental[]

deprecated[5.4.0, `_field_stats` is deprecated, use `_field_caps` instead or run an min/max aggregation on the desired fields]

The field stats api allows one to find statistical properties of a field
without executing a search, but looking up measurements that are natively
available in the Lucene index. This can be useful to explore a dataset which
Expand All @@ -19,6 +21,7 @@ All indices:
GET _field_stats?fields=rating
--------------------------------------------------
// CONSOLE
// TEST[warning:[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields.]

Specific indices:

Expand All @@ -27,6 +30,7 @@ Specific indices:
GET twitter/_field_stats?fields=rating
--------------------------------------------------
// CONSOLE
// TEST[warning:[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields.]
// TEST[setup:twitter]

Supported request options:
Expand All @@ -47,6 +51,7 @@ POST _field_stats?level=indices
}
--------------------------------------------------
// CONSOLE
// TEST[warning:[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields.]

This is equivalent to the previous request.

Expand Down Expand Up @@ -122,6 +127,7 @@ Request:
GET _field_stats?fields=rating,answer_count,creation_date,display_name
--------------------------------------------------
// CONSOLE
// TEST[warning:[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields.]

Response:

Expand Down Expand Up @@ -235,6 +241,7 @@ Request:
GET _field_stats?fields=rating,answer_count,creation_date,display_name&level=indices
--------------------------------------------------
// CONSOLE
// TEST[warning:[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields.]

Response:

Expand Down Expand Up @@ -330,6 +337,7 @@ POST _field_stats?level=indices
}
--------------------------------------------------
// CONSOLE
// TEST[warning:[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields.]

<1> The fields to compute and return field stats for.
<2> The set index constraints. Note that index constrains can be defined for fields that aren't defined in the `fields` option.
Expand Down Expand Up @@ -368,5 +376,6 @@ POST _field_stats?level=indices
}
--------------------------------------------------
// CONSOLE
// TEST[warning:[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields.]

<1> Custom date format
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ setup:
---
"Get simple field caps":
- skip:
version: " - 5.99.99"
reason: this uses a new API that has been added in 6.0
version: " - 5.3.99"
reason: this uses a new API that has been added in 5.4.0

- do:
field_caps:
Expand Down Expand Up @@ -117,8 +117,8 @@ setup:
---
"Get nested field caps":
- skip:
version: " - 5.99.99"
reason: this uses a new API that has been added in 6.0
version: " - 5.3.99"
reason: this uses a new API that has been added in 5.4.0

- do:
field_caps:
Expand Down Expand Up @@ -148,8 +148,8 @@ setup:
---
"Get prefix field caps":
- skip:
version: " - 5.99.99"
reason: this uses a new API that has been added in 6.0
version: " - 5.3.99"
reason: this uses a new API that has been added in 5.4.0

- do:
field_caps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ setup:

---
"Basic field stats":
- skip:
version: " - 5.99.99"
reason: Deprecation was added in 6.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused: are we deprecating in 5.4 or 6.0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it to not break tests until this is backported to 5.4 like you mention in the PR description?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sorry for the confusion. I should have added a note here

features: warnings

- do:
warnings:
- "[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields."
field_stats:
fields: [foo, number]

Expand Down Expand Up @@ -87,10 +94,13 @@ setup:
---
"Geo field stats":
- skip:
version: " - 5.3.0"
reason: geo_point fields don't return min/max for versions greater than 5.2.0
version: " - 5.99.99"
reason: Deprecation was added in 6.0.0
features: warnings

- do:
warnings:
- "[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields."
field_stats:
fields: [geo, geo_shape]

Expand All @@ -116,7 +126,14 @@ setup:

---
"Basic field stats with level set to indices":
- skip:
version: " - 5.99.99"
reason: Deprecation was added in 6.0.0
features: warnings

- do:
warnings:
- "[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields."
field_stats:
fields: [foo, number]
level: indices
Expand Down Expand Up @@ -164,10 +181,13 @@ setup:
---
"Geo field stats with level set to indices":
- skip:
version: " - 5.3.0"
reason: geo_point fields don't return min/max for versions greater than 5.2.0
version: " - 5.99.99"
reason: Deprecation was added in 6.0.0
features: warnings

- do:
warnings:
- "[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields."
field_stats:
fields: [geo, geo_shape]
level: indices
Expand Down Expand Up @@ -196,10 +216,13 @@ setup:
---
"Geopoint field stats":
- skip:
version: " - 5.3.0"
reason: geo_point type not handled for versions earlier than 6.0.0
version: " - 5.99.99"
reason: Deprecation was added in 6.0.0
features: warnings

- do:
warnings:
- "[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields."
field_stats:
fields: [geo]
level: indices
Expand All @@ -216,8 +239,14 @@ setup:

---
"Field stats with filtering":
- skip:
version: " - 5.99.99"
reason: Deprecation was added in 6.0.0
features: warnings

- do:
warnings:
- "[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields."
field_stats:
level: indices
index: test_1
Expand All @@ -234,6 +263,8 @@ setup:
- is_false: conflicts

- do:
warnings:
- "[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields."
field_stats:
level: indices
index: test_1
Expand All @@ -243,6 +274,11 @@ setup:

---
"Field stats both source and fields":
- skip:
version: " - 5.99.99"
reason: Deprecation was added in 6.0.0
features: warnings

- do:
catch: request
field_stats:
Expand All @@ -252,7 +288,14 @@ setup:

---
"Field stats with conflicts":
- skip:
version: " - 5.99.99"
reason: Deprecation was added in 6.0.0
features: warnings

- do:
warnings:
- "[_field_stats] endpoint is deprecated! Use [_field_caps] instead or run a min/max aggregations on the desired fields."
field_stats:
fields: [foo, number, bar]

Expand Down