There is no such thing as perfect programming, but we shouldn’t be discouraged because programming is a constant pursuit of perfection.

Q: What are the features of _size?

A:



Q: How is _size used?

A:

Install mapper-size plugin PUT /size_test {"mappings" : {
    "_size" : {
      "enabled" : true
    },
    "properties" : {
      "name" : {"type" : "text"}
    }
  }
}

# 索引
POST /size_test/_doc/1
{
  "name" : "hello good"} # index POST /size_test/_doc/2
{
  "name" : "hello this is me"} # GET /size_test/_search {"query" : {
    "range" : {
      "_size" : {
        "lt" : 50}}},"aggs" : {
    "sizes" : {
      "terms" : {
        "field" : "_size"."size"  : 10}}},"sort": [{"_size" : {
        "order" : "desc"}}]."script_fields" : {
    "size" : {
      "script": "doc['_size']"}},"docvalue_fields": [{"field" : "_size"}]} # result {"took" : 2."timed_out" : false."_shards" : {
    "total" : 1."successful" : 1."skipped" : 0."failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 2."relation" : "eq"
    },
    "max_score" : null."hits": [{"_index" : "size_test"."_type" : "_doc"."_id" : "2"."_score" : null."fields" : {
          "_size" : [
            34]."size" : [
            34]},"sort" : [
          34] {},"_index" : "size_test"."_type" : "_doc"."_id" : "1"."_score" : null."fields" : {
          "_size" : [
            28]."size" : [
            28]},"sort" : [
          28]]}},"aggregations" : {
    "sizes" : {
      "doc_count_error_upper_bound" : 0."sum_other_doc_count" : 0."buckets": [{"key" : 28."doc_count" : 1
        },
        {
          "key" : 34."doc_count" : 1}]}}}Copy the code