You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 21, 2021. It is now read-only.
Copy file name to clipboardexpand all lines: 010_Intro/25_Tutorial_Indexing.asciidoc
+7-17
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ So, sit back and enjoy a whirlwind tour of what Elasticsearch is capable of.
16
16
We happen((("employee directory, building (example)"))) to work for _Megacorp_, and as part of HR's new _"We love our
17
17
drones!"_ initiative, we have been tasked with creating an employee directory.
18
18
The directory is supposed to foster employer empathy and
19
-
real-time, synergistic, dynamic collaboration, so it has a few
19
+
real-time, synergistic, dynamic collaboration, so it has a few
20
20
business requirements:
21
21
22
22
* Enable data to contain multi value tags, numbers, and full text.
@@ -34,17 +34,10 @@ of an _employee document_: a single document represents a single
34
34
employee. The act of storing data in Elasticsearch is called _indexing_, but
35
35
before we can index a document, we need to decide _where_ to store it.
36
36
37
-
In Elasticsearch, a document belongs to a _type_, and those((("types"))) types live inside
38
-
an _index_. ((("indices")))You can draw some (rough) parallels to a traditional relational database:
39
37
40
-
----
41
-
Relational DB ⇒ Databases ⇒ Tables ⇒ Rows ⇒ Columns
42
-
Elasticsearch ⇒ Indices ⇒ Types ⇒ Documents ⇒ Fields
43
-
----
44
-
45
-
An Elasticsearch cluster can((("clusters", "indices (databases) in")))((("databases", "in clusters"))) contain multiple _indices_ (databases), which in
46
-
turn contain multiple _types_ (tables).((("tables"))) These types hold multiple _documents_
47
-
(rows), and ((("rows")))each document has((("fields")))((("columns"))) multiple _fields_ (columns).
38
+
An Elasticsearch cluster can((("clusters", "indices in")))(((in clusters"))) contain multiple _indices_, which in
39
+
turn contain multiple _types_.((("tables"))) These types hold multiple _documents_,
40
+
and each document has((("fields"))) multiple _fields_.
We are searching in the `title` field in both types. The query string needs
83
-
to be analyzed, but which analyzer does it use: `spanish` or `english`? It
84
-
will use the analyzer for the first `title` field that it finds, which
85
-
will be correct for some docs and incorrect for the others.
86
-
87
-
We can avoid this problem either by naming the fields differently--for example, `title_en` and `title_es`—or by explicitly including the type name in the
88
-
field name and querying each field separately:
103
+
Each type defines two fields (`"name"`/`"address"` and `"timestamp"`/`"message"`
104
+
respectively). It may look like they are independent, but under the covers Lucene
105
+
will create a single mapping which would look something like this:
0 commit comments