Does none-indexd field has doc values?

hi, if i set one filed type to text, and the index attribute set to false, dose this field will generate doc values?

No. It won't be indexed at all.

what if for long type filed, i found can set a long filed as follow, i set index to false, and then i put a recored to the index, and then i can agg on this long filed. so, i guess if es build doc values fo this field?

PUT my_index_xxx
{
  "mappings": {
    "my_type": {
      "properties": {
        "customer_token": {
          "type":       "long",
          "index": "false" 
        }
      }
    }
  }
}

POST my_index_xxx/my_type
{
  "customer_token":"10"
}


GET my_index_xxx/my_type/_search
{
  "aggs": {
    "NAME": {
      "terms": {
        "field": "customer_token",
        "size": 10
      }
    }
  }
}

and the search result is:
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "my_index_xxx",
        "_type" : "my_type",
        "_id" : "st4YTWkBHyBYKlyphyhi",
        "_score" : 1.0,
        "_source" : {
          "customer_token" : "10"
        }
      }
    ]
  },
  "aggregations" : {
    "NAME" : {
      "doc_count_error_upper_bound" : 0,
      "sum_other_doc_count" : 0,
      "buckets" : [
        {
          "key" : 10,
          "doc_count" : 1
        }
      ]
    }
  }
} 

Yes. Doc values are activated by default on numbers. See https://www.elastic.co/guide/en/elasticsearch/reference/6.6/number.html#number-params

Doc values don't exist on text type. See https://www.elastic.co/guide/en/elasticsearch/reference/6.6/text.html

thanks for your reply, by the way , if i set a text field index to false, dose es will build norms? because i see norms are set default to true on text field.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.