Skip to content

Commit

Permalink
Add extra section on doc-value-only fields to documentation (elastic#…
Browse files Browse the repository at this point in the history
…84209)

Adds a dedicated section for doc-value-only fields to the docs that can be linked to.
  • Loading branch information
ywelsch committed Feb 22, 2022
1 parent bf1668b commit abfc4c9
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions docs/reference/mapping/params/doc-values.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,45 @@ makes this data access pattern possible. They store the same values as the
sorting and aggregations. Doc values are supported on almost all field types,
with the __notable exception of `text` and `annotated_text` fields__.

[[doc-value-only-fields]]
==== Doc-value-only fields

<<number,Numeric types>>, <<date,date types>>, the <<boolean,boolean type>>,
<<ip,ip type>>, <<geo-point,geo_point type>> and the <<keyword,keyword type>>
can also be queried
when they are not <<mapping-index,indexed>> but only have doc values enabled.
can also be queried when they are not <<mapping-index,indexed>> but only
have doc values enabled.
Query performance on doc values is much slower than on index structures, but
offers an interesting tradeoff between disk usage and query performance for
fields that are only rarely queried and where query performance is not as
important.
important. This makes doc-value-only fields a good fit for fields that are
not expected to be normally used for filtering, for example gauges or
counters on metric data.

Doc-value-only fields can be configured as follows:

[source,console]
--------------------------------------------------
PUT my-index-000001
{
"mappings": {
"properties": {
"status_code": { <1>
"type": "long"
},
"session_id": { <2>
"type": "long",
"index": false
}
}
}
}
--------------------------------------------------

<1> The `status_code` field is a regular long field.
<2> The `session_id` field has `index` disabled, and is therefore a
doc-value-only long field as doc values are enabled by default.

==== Disabling doc values

All fields which support doc values have them enabled by default. If you are
sure that you don't need to sort or aggregate on a field, or access the field
Expand Down

0 comments on commit abfc4c9

Please sign in to comment.