Skip to content

Commit a763af9

Browse files
author
Christoph Büscher
committed
[Docs] Improve tuning for speed advice (#33315)
This change merges two sections in the "Tune for search speed" documentation that recommend mapping numeric identifiers as keywords. Both sections contain mostly the same advice, so they can be merged. Closes #32733
1 parent 4151bd2 commit a763af9

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

docs/reference/how-to/search-speed.asciidoc

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,15 @@ GET index/_search
165165
// TEST[continued]
166166

167167
[float]
168-
=== Mappings
168+
=== Consider mapping identifiers as `keyword`
169169

170170
The fact that some data is numeric does not mean it should always be mapped as a
171-
<<number,numeric field>>. Typically, fields storing identifiers such as an `ISBN`
172-
or any number identifying a record from another database, might benefit from
173-
being mapped as <<keyword,`keyword`>> rather than `integer` or `long`.
171+
<<number,numeric field>>. The way that Elasticsearch indexes numbers optimizes
172+
for `range` queries while `keyword` fields are better at `term` queries. Typically,
173+
fields storing identifiers such as an `ISBN` or any number identifying a record
174+
from another database are rarely used in `range` queries or aggregations. This is
175+
why they might benefit from being mapped as <<keyword,`keyword`>> rather than as
176+
`integer` or `long`.
174177

175178
[float]
176179
=== Avoid scripts
@@ -349,15 +352,6 @@ WARNING: Loading data into the filesystem cache eagerly on too many indices or
349352
too many files will make search _slower_ if the filesystem cache is not large
350353
enough to hold all the data. Use with caution.
351354

352-
[float]
353-
=== Map identifiers as `keyword`
354-
355-
When you have numeric identifiers in your documents, it is tempting to map them
356-
as numbers, which is consistent with their json type. However, the way that
357-
Elasticsearch indexes numbers optimizes for `range` queries while `keyword`
358-
fields are better at `term` queries. Since identifiers are never used in `range`
359-
queries, they should be mapped as a `keyword`.
360-
361355
[float]
362356
=== Use index sorting to speed up conjunctions
363357

0 commit comments

Comments
 (0)