Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Commit 00fde4f

Browse files
committed
Edited 080_Structured_Search/30_existsmissing.asciidoc with Atlas code editor
1 parent 2b37b29 commit 00fde4f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Diff for: 080_Structured_Search/30_existsmissing.asciidoc

+15-15
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ look at that inverted index from the previous section:
1717

1818
How would you store a field that doesn't exist in that data structure? You
1919
can't! An inverted index is simply a list of tokens and the documents that
20-
contain them. If a field doesn't exist... it doesn't hold any tokens, which
20+
contain them. If a field doesn't exist, it doesn't hold any tokens, which
2121
means it won't be represented in an inverted index data structure.
2222

2323
Ultimately, this((("strings", "empty")))((("arrays", "empty"))) means that a `null`, `""` (an empty string), `[]` (an empty
24-
array), and `[null]` are all equivalent... they simply don't exist in the
24+
array), and `[null]` are all equivalent. They simply don't exist in the
2525
inverted index!
2626

27-
Obviously the world is not simple, and data is often missing fields, contains
27+
Obviously, the world is not simple, and data is often missing fields, or contains
2828
explicit nulls or empty arrays. To deal with these situations, Elasticsearch has
2929
a few tools to work with null or missing values.
3030

31-
==== Exists Filter
31+
==== exists Filter
3232

3333
The first tool in your arsenal is the `exists` filter.((("null values", "working with, using exists filter")))((("exists filter"))) This filter will return
3434
documents that have any value in the specified field. Let's use the tagging example
@@ -117,17 +117,17 @@ Our query returns three documents:
117117
}
118118
]
119119
--------------------------------------------------
120-
<1> Doc `5` is returned even though it contains a `null` value. The field
121-
exists because a real value tag was indexed, so the `null` had no impact
120+
<1> Document 5 is returned even though it contains a `null` value. The field
121+
exists because a real-value tag was indexed, so the `null` had no impact
122122
on the filter.
123123

124-
The results are easy to understand. Any document that has actual terms in the
124+
The results are easy to understand. Any document that has terms in the
125125
`tags` field was returned as a hit. The only two documents that were excluded
126-
were documents `3` and `4`.
126+
were documents 3 and 4.
127127

128-
==== Missing Filter
128+
==== missing Filter
129129

130-
The `missing` filter is essentially((("null values", "working with, using missing filter")))((("missing filter"))) the inverse of the `exists`: it returns
130+
The `missing` filter is essentially((("null values", "working with, using missing filter")))((("missing filter"))) the inverse of `exists`: it returns
131131
documents where there is _no_ value for a particular field, much like this
132132
SQL:
133133

@@ -138,7 +138,7 @@ FROM posts
138138
WHERE tags IS NULL
139139
--------------------------------------------------
140140

141-
Let's swap the `exists` filter for a `missing` filter from our example above:
141+
Let's swap the `exists` filter for a `missing` filter from our previous example:
142142

143143
[source,js]
144144
--------------------------------------------------
@@ -156,8 +156,8 @@ GET /my_index/posts/_search
156156
// SENSE: 080_Structured_Search/30_Exists_missing.json
157157

158158

159-
And, as you would expect, we get back the two docs which have no real values
160-
in the `tags` field -- docs `3` and `4`:
159+
And, as you would expect, we get back the two docs that have no real values
160+
in the `tags` field--documents 3 and 4:
161161

162162
[source,json]
163163
--------------------------------------------------
@@ -175,12 +175,12 @@ in the `tags` field -- docs `3` and `4`:
175175
]
176176
--------------------------------------------------
177177

178-
.When `null` means `null`
178+
.When null Means null
179179
****
180180
181181
Sometimes you need to be able to distinguish between a field that doesn't have
182182
a value, and a field that has been explicitly set to `null`. With the default
183-
behavior that we saw above, this is impossible -- the data is lost. Luckily,
183+
behavior that we saw previously, this is impossible; the data is lost. Luckily,
184184
there is an option that we can set that replaces explicit `null` values with
185185
a ``placeholder'' value of our choosing.
186186

0 commit comments

Comments
 (0)