mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-27 10:28:28 +00:00
The field stats api returns field level statistics such as lowest, highest values and number of documents that have at least one value for a field. An api like this can be useful to explore a data set you don't know much about. For example you can figure at with the lowest and highest response times are, so that you can create a histogram or range aggregation with sane settings. This api doesn't run a search to figure this statistics out, but rather use the Lucene index look these statics up (using Terms class in Lucene). So finding out these stats for fields is cheap and quick. The min/max values are based on the type of the field. So for a numeric field min/max are numbers and date field the min/max date and other fields the min/max are term based. Closes #10523
46 lines
1.5 KiB
Java
46 lines
1.5 KiB
Java
/*
|
|
* Licensed to Elasticsearch under one or more contributor
|
|
* license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright
|
|
* ownership. Elasticsearch licenses this file to you under
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
* not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the License is distributed on an
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
* KIND, either express or implied. See the License for the
|
|
* specific language governing permissions and limitations
|
|
* under the License.
|
|
*/
|
|
|
|
package org.elasticsearch.action.fieldstats;
|
|
|
|
import org.elasticsearch.action.ClientAction;
|
|
import org.elasticsearch.client.Client;
|
|
|
|
/**
|
|
*/
|
|
public class FieldStatsAction extends ClientAction<FieldStatsRequest, FieldStatsResponse, FieldStatsRequestBuilder> {
|
|
|
|
public static final FieldStatsAction INSTANCE = new FieldStatsAction();
|
|
public static final String NAME = "indices:data/read/field_stats";
|
|
|
|
private FieldStatsAction() {
|
|
super(NAME);
|
|
}
|
|
|
|
@Override
|
|
public FieldStatsResponse newResponse() {
|
|
return new FieldStatsResponse();
|
|
}
|
|
|
|
@Override
|
|
public FieldStatsRequestBuilder newRequestBuilder(Client client) {
|
|
return new FieldStatsRequestBuilder(client);
|
|
}
|
|
}
|