|
@@ -80,6 +80,31 @@ to help make a decision.
|
|
|
|`half_float`|+2^-24^+ |+65504+ |+11+ / +3.31+
|
|
|
|=======================================================================
|
|
|
|
|
|
+[TIP]
|
|
|
+.Mapping numeric identifiers
|
|
|
+====
|
|
|
+// tag::map-ids-as-keyword[]
|
|
|
+Not all numeric data should be mapped as a <<number,numeric>> field datatype.
|
|
|
+{es} optimizes numeric fields, such as `integer` or `long`, for
|
|
|
+<<query-dsl-range-query,`range`>> queries. However, <<keyword,`keyword`>> fields
|
|
|
+are better for <<query-dsl-term-query,`term`>> and other
|
|
|
+<<term-level-queries,term-level>> queries.
|
|
|
+
|
|
|
+Identifiers, such as an ISBN or a product ID, are rarely used in `range`
|
|
|
+queries. However, they are often retrieved using term-level queries.
|
|
|
+
|
|
|
+Consider mapping a numeric identifier as a `keyword` if:
|
|
|
+
|
|
|
+* You don't plan to search for the identifier data using
|
|
|
+ <<query-dsl-range-query,`range`>> queries.
|
|
|
+* Fast retrieval is important. `term` query searches on `keyword` fields are
|
|
|
+ often faster than `term` searches on numeric fields.
|
|
|
+
|
|
|
+If you're unsure which to use, you can use a <<multi-fields,multi-field>> to map
|
|
|
+the data as both a `keyword` _and_ a numeric datatype.
|
|
|
+// end::map-ids-as-keyword[]
|
|
|
+====
|
|
|
+
|
|
|
[[number-params]]
|
|
|
==== Parameters for numeric fields
|
|
|
|