mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-03 17:39:15 +00:00
* Default include_type_name to false for get and put mappings. * Default include_type_name to false for get field mappings. * Add a constant for the default include_type_name value. * Default include_type_name to false for get and put index templates. * Default include_type_name to false for create index. * Update create index calls in REST documentation to use include_type_name=true. * Some minor clean-ups around the get index API. * In REST tests, use include_type_name=true by default for index creation. * Make sure to use 'expression == false'. * Clarify the different IndexTemplateMetaData toXContent methods. * Fix FullClusterRestartIT#testSnapshotRestore. * Fix the ml_anomalies_default_mappings test. * Fix GetFieldMappingsResponseTests and GetIndexTemplateResponseTests. We make sure to specify include_type_name=true during xContent parsing, so we continue to test the legacy typed responses. XContent generation for the typeless responses is currently only covered by REST tests, but we will be adding unit test coverage for these as we implement each typeless API in the Java HLRC. This commit also refactors GetMappingsResponse to follow the same appraoch as the other mappings-related responses, where we read include_type_name out of the xContent params, instead of creating a second toXContent method. This gives better consistency in the response parsing code. * Fix more REST tests. * Improve some wording in the create index documentation. * Add a note about types removal in the create index docs. * Fix SmokeTestMonitoringWithSecurityIT#testHTTPExporterWithSSL. * Make sure to mention include_type_name in the REST docs for affected APIs. * Make sure to use 'expression == false' in FullClusterRestartIT. * Mention include_type_name in the REST templates docs.
47 lines
1.7 KiB
Plaintext
47 lines
1.7 KiB
Plaintext
[[doc-values]]
|
|
=== `doc_values`
|
|
|
|
Most fields are <<mapping-index,indexed>> by default, which makes them
|
|
searchable. The inverted index allows queries to look up the search term in
|
|
unique sorted list of terms, and from that immediately have access to the list
|
|
of documents that contain the term.
|
|
|
|
Sorting, aggregations, and access to field values in scripts requires a
|
|
different data access pattern. Instead of looking up the term and finding
|
|
documents, we need to be able to look up the document and find the terms that
|
|
it has in a field.
|
|
|
|
Doc values are the on-disk data structure, built at document index time, which
|
|
makes this data access pattern possible. They store the same values as the
|
|
`_source` but in a column-oriented fashion that is way more efficient for
|
|
sorting and aggregations. Doc values are supported on almost all field types,
|
|
with the __notable exception of `analyzed` string fields__.
|
|
|
|
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
|
|
value from a script, you can disable doc values in order to save disk space:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
PUT my_index?include_type_name=true
|
|
{
|
|
"mappings": {
|
|
"_doc": {
|
|
"properties": {
|
|
"status_code": { <1>
|
|
"type": "keyword"
|
|
},
|
|
"session_id": { <2>
|
|
"type": "keyword",
|
|
"doc_values": false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// CONSOLE
|
|
<1> The `status_code` field has `doc_values` enabled by default.
|
|
<2> The `session_id` has `doc_values` disabled, but can still be queried.
|
|
|