@@ -5,30 +5,27 @@ By default, each subfield in an object is mapped and indexed separately. If
5
5
the names or types of the subfields are not known in advance, then they are
6
6
<<dynamic-mapping, mapped dynamically>>.
7
7
8
- The `embedded_json` type provides an alternative approach, where the entire object is
9
- mapped as a single field. Given an object, the `embedded_json` mapping will parse out
10
- its leaf values and index them into one field. The object's contents can then
11
- be searched through simple keyword-style queries.
12
-
13
- This data type can be useful for indexing objects with a very large number of
14
- distinct keys. Compared to mapping each field separately, embedded JSON fields have
15
- the following advantages:
16
-
17
- - Only one field mapping is created for the whole object, which can help
18
- prevent a <<mapping-limit-settings, mappings explosion>> due to a large
19
- number of field mappings.
20
- - An embedded JSON field may take up less space in the index, as only one underlying
21
- field is created.
22
-
23
- However, embedded JSON fields present a trade-off in terms of search functionality.
24
- Only basic queries are allowed, with no support for numeric range queries or
25
- highlighting. Further information on the limitations can be found in the
26
- <<supported-operations, Supported operations>> section.
27
-
28
- NOTE: The `embedded_json` mapping type should **not** be used for indexing all JSON
29
- content, as it provides only limited search functionality. The default
30
- approach, where each subfield has its own entry in the mappings, works well in
31
- the majority of cases.
8
+ The `embedded_json` type provides an alternative approach, where the entire
9
+ object is mapped as a single field. Given an object, the `embedded_json`
10
+ mapping will parse out its leaf values and index them into one field as
11
+ keywords. The object's contents can then be searched through simple queries
12
+ and aggregations.
13
+
14
+ This data type can be useful for indexing objects with a large or unknown
15
+ number of unique keys. Embedded JSON fields create only one field mapping
16
+ for the whole object, which can help prevent a
17
+ <<mapping-limit-settings, mappings explosion>> from having too many distinct
18
+ field mappings.
19
+
20
+ However, embedded JSON fields present a trade-off in terms of search
21
+ functionality. Only basic queries are allowed, with no support for numeric
22
+ range queries or highlighting. Further information on the limitations can be
23
+ found in the <<supported-operations, Supported operations>> section.
24
+
25
+ NOTE: The `embedded_json` mapping type should **not** be used for indexing all
26
+ JSON content, as it treats all values as keywords and does not provide full
27
+ search functionality. The default approach, where each subfield has its own
28
+ entry in the mappings, works well in the majority of cases.
32
29
33
30
An embedded JSON field can be created as follows:
34
31
[source,js]
@@ -67,7 +64,9 @@ During indexing, tokens are created for each leaf value in the JSON object. The
67
64
values are indexed as string keywords, without analysis or special handling for
68
65
numbers or dates.
69
66
70
- Querying the top-level `embedded_json` field searches all leaf values in the object:
67
+ Querying the top-level `embedded_json` field searches all leaf values in the
68
+ object:
69
+
71
70
[source,js]
72
71
--------------------------------
73
72
POST bug_reports/_search
@@ -94,6 +93,10 @@ POST bug_reports/_search
94
93
[[supported-operations]]
95
94
==== Supported operations
96
95
96
+ Because of the similarities in the way values are indexed, `embedded_json`
97
+ fields share much of the same mapping and search functionality as
98
+ <<keyword, `keyword`>> fields.
99
+
97
100
Currently, embedded JSON fields can be used with the following query types:
98
101
99
102
- `term`, `terms`, and `terms_set`
@@ -119,9 +122,7 @@ the <<mapping-store, `store`>> parameter in the mapping.
119
122
[[json-params]]
120
123
==== Parameters for JSON fields
121
124
122
- Because of the similarities in the way values are indexed, the `embedded_json` type
123
- shares many mapping options with <<keyword, `keyword`>>. The following
124
- parameters are accepted:
125
+ The following mapping parameters are accepted:
125
126
126
127
[horizontal]
127
128
0 commit comments