Skip to content

Commit 83e147b

Browse files
committed
merge upstream, fix build error
2 parents 757a196 + 37c514a commit 83e147b

File tree

121 files changed

+1571
-1622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+1571
-1622
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
<!--
12
Thanks for the Pull Request! We really appreciate your help and contribution!
23
34
Before you submit the PR, have you signed Contributor License Agreement: https://www.elastic.co/contributor-agreement/ ?
45
56
PR's (no matter how small) cannot be merged until the CLA has been signed.
67
It only needs to be signed once, however. Thanks!
8+
-->

010_Intro/15_API.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
=== Talking to Elasticsearch
22

3-
How you talk to Elasticsearch depends on((("Elasticsearch", "talking to"))) whether you are using Java.
3+
How you talk to Elasticsearch depends on((("Elasticsearch", "talking to"))) whether you are using Java or not.
44

55
==== Java API
66

010_Intro/25_Tutorial_Indexing.asciidoc

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ So, sit back and enjoy a whirlwind tour of what Elasticsearch is capable of.
1616
We happen((("employee directory, building (example)"))) to work for _Megacorp_, and as part of HR's new _"We love our
1717
drones!"_ initiative, we have been tasked with creating an employee directory.
1818
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
2020
business requirements:
2121

2222
* 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
3434
employee. The act of storing data in Elasticsearch is called _indexing_, but
3535
before we can index a document, we need to decide _where_ to store it.
3636

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:
3937

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_.
4841

4942
.Index Versus Index Versus Index
5043
**************************************************
@@ -108,11 +101,11 @@ information:
108101

109102
+megacorp+::
110103
The index name
111-
104+
112105
+employee+::
113106
The type name
114-
115-
+1+::
107+
108+
+1+::
116109
The ID of this particular employee
117110

118111
The request body--the JSON document--contains all the information about
@@ -147,6 +140,3 @@ PUT /megacorp/employee/3
147140
}
148141
--------------------------------------------------
149142
// SENSE: 010_Intro/25_Index.json
150-
151-
152-

010_Intro/30_Tutorial_Search.asciidoc

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,15 @@ which allows us to execute structured searches efficiently:
209209
GET /megacorp/employee/_search
210210
{
211211
"query" : {
212-
"filtered" : {
213-
"filter" : {
214-
"range" : {
215-
"age" : { "gt" : 30 } <1>
212+
"bool": {
213+
"must": {
214+
"match" : {
215+
"last_name" : "smith" <1>
216216
}
217217
},
218-
"query" : {
219-
"match" : {
220-
"last_name" : "smith" <2>
218+
"filter": {
219+
"range" : {
220+
"age" : { "gt" : 30 } <2>
221221
}
222222
}
223223
}
@@ -226,13 +226,15 @@ GET /megacorp/employee/_search
226226
--------------------------------------------------
227227
// SENSE: 010_Intro/30_Query_DSL.json
228228

229-
<1> This portion of the query is a `range` _filter_, which((("range filters"))) will find all ages
229+
<1> This portion of the query is the((("match queries"))) same `match` _query_ that we used before.
230+
<2> This portion of the query is a `range` _filter_, which((("range filters"))) will find all ages
230231
older than 30&#x2014;`gt` stands for _greater than_.
231-
<2> This portion of the query is the((("match queries"))) same `match` _query_ that we used before.
232+
232233

233234
Don't worry about the syntax too much for now; we will cover it in great
234235
detail later. Just recognize that we've added a _filter_ that performs a
235-
range search, and reused the same `match` query as before. Now our results show only one employee who happens to be 32 and is named Jane Smith:
236+
range search, and reused the same `match` query as before. Now our results show
237+
only one employee who happens to be 32 and is named Jane Smith:
236238

237239
[source,js]
238240
--------------------------------------------------
@@ -446,4 +448,3 @@ HTML tags:
446448

447449
You can read more about the highlighting of search snippets in the
448450
{ref}/search-request-highlighting.html[highlighting reference documentation].
449-

030_Data/05_Document.asciidoc

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,30 @@ other objects. In Elasticsearch, the term _document_ has a specific meaning. It
3939
to the top-level, or root object that((("root object"))) is serialized into JSON and
4040
stored in Elasticsearch under a unique ID.
4141

42+
WARNING: Field names can be any valid string, but _may not_ include periods.
43+
4244
=== Document Metadata
4345

4446
A document doesn't consist only of its data.((("documents", "metadata"))) It also has
4547
_metadata_&#x2014;information _about_ the document.((("metadata, document"))) The three required metadata
4648
elements are as follows:
4749

4850

49-
`_index`::
51+
`_index`::
5052
Where the document lives
51-
52-
`_type`::
53+
54+
`_type`::
5355
The class of object that the document represents
54-
55-
`_id`::
56+
57+
`_id`::
5658
The unique identifier for the document
5759

5860
==== _index
5961

60-
An _index_ is like a database in a relational database; it's the place
61-
we store and index related data.((("indices", "_index, in document metadata")))
62+
An _index_ is a collection of documents that should be grouped together for a
63+
common reason. For example, you may store all your products in a `products` index,
64+
while all your sales transactions go in `sales`. Although it is possible to store
65+
unrelated data together in a single index, it is often considered an anti-pattern.
6266

6367
[TIP]
6468
====
@@ -76,28 +80,23 @@ underscore, and cannot contain commas. Let's use `website` as our index name.
7680

7781
==== _type
7882

79-
In applications, we use objects to represent _things_ such as a user, a blog
80-
post, a comment, or an email. Each object belongs to a _class_ that defines
81-
the properties or data associated with an object. Objects in the `user` class
82-
may have a name, a gender, an age, and an email address.
83-
84-
In a relational database, we usually store objects of the same class in the
85-
same table, because they share the same data structure. For the same reason, in
86-
Elasticsearch we use the same _type_ for ((("types", "&#x5f;type, in document metadata)))documents that represent the same
87-
class of _thing_, because they share the same data structure.
83+
Data may be grouped loosely together in an index, but often there are sub-partitions
84+
inside that data which may be useful to explicitly define. For example, all your
85+
products may go inside a single index. But you have different categories of products,
86+
such as "electronics", "kitchen" and "lawn-care".
8887

89-
Every _type_ has its own <<mapping,mapping>> or schema ((("mapping (types)")))((("schema definition, types")))definition, which
90-
defines the data structure for documents of that type, much like the columns
91-
in a database table. Documents of all types can be stored in the same index,
92-
but the _mapping_ for the type tells Elasticsearch how the data in each
93-
document should be indexed.
88+
The documents all share an identical (or very similar) schema: they have a title,
89+
description, product code, price. They just happen to belong to sub-categories
90+
under the umbrella of "Products".
9491

95-
We show how to specify and manage mappings in <<mapping>>, but for now
96-
we will rely on Elasticsearch to detect our document's data structure
97-
automatically.
92+
Elasticsearch exposes a feature called _types_ which allows you to logically
93+
partition data inside of an index. Documents in different types may have different
94+
fields, but it is best if they are highly similar. We'll talk more about the restrictions
95+
and applications of types in <<mapping>>.
9896

9997
A `_type` name can be lowercase or uppercase, but shouldn't begin with an
100-
underscore or contain commas.((("types", "names of"))) We will use `blog` for our type name.
98+
underscore or period. It also may not contain commas,((("types", "names of")))
99+
and is limited to a length of 256 characters. We will use `blog` for our type name.
101100

102101
==== _id
103102

030_Data/10_Index.asciidoc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Elasticsearch responds as follows:
5252
--------------------------------------------------
5353

5454

55-
The response indicates that the indexing request has been successfully created
55+
The response indicates that the document has been successfully created
5656
and includes the `_index`, `_type`, and `_id` metadata, and a new element:
5757
`_version`.((("version number (documents)")))
5858

@@ -95,9 +95,6 @@ field has been generated for us:
9595
}
9696
--------------------------------------------------
9797

98-
Autogenerated IDs are 20 character long, URL-safe, Base64-encoded string
99-
_universally unique identifiers_, or((("UUIDs (universally unique identifiers)"))) http://en.wikipedia.org/wiki/Uuid[UUIDs].
100-
101-
102-
103-
98+
Autogenerated IDs are 20 character long, URL-safe, Base64-encoded GUID strings. These
99+
GUIDs are generated from a modified FlakeID scheme which allows multiple nodes
100+
to be generating unique IDs in parallel with essentially zero chance of collision.

030_Data/15_Get.asciidoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ display the response headers:
5151
--------------------------------------------------
5252
curl -i -XGET http://localhost:9200/website/blog/124?pretty
5353
--------------------------------------------------
54-
// SENSE: 030_Data/15_Get_document.json
5554

5655

5756
The response now looks like this:
@@ -94,7 +93,7 @@ filtered out the `date` field:
9493
"_type" : "blog",
9594
"_id" : "123",
9695
"_version" : 1,
97-
"exists" : true,
96+
"found" : true,
9897
"_source" : {
9998
"title": "My first blog entry" ,
10099
"text": "Just trying this out..."

030_Data/30_Create.asciidoc

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,21 @@ code, and an error message like the following:
4747
[source,js]
4848
--------------------------------------------------
4949
{
50-
"error" : "DocumentAlreadyExistsException[[website][4] [blog][123]:
51-
document already exists]",
52-
"status" : 409
50+
"error": {
51+
"root_cause": [
52+
{
53+
"type": "document_already_exists_exception",
54+
"reason": "[blog][123]: document already exists",
55+
"shard": "0",
56+
"index": "website"
57+
}
58+
],
59+
"type": "document_already_exists_exception",
60+
"reason": "[blog][123]: document already exists",
61+
"shard": "0",
62+
"index": "website"
63+
},
64+
"status": 409
5365
}
5466
--------------------------------------------------
5567
// SENSE: 030_Data/30_Create_doc.json

030_Data/40_Version_control.asciidoc

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,21 @@ code, and a body like the following:
154154
[source,js]
155155
--------------------------------------------------
156156
{
157-
"error" : "VersionConflictEngineException[[website][2] [blog][1]:
158-
version conflict, current [2], provided [1]]",
159-
"status" : 409
157+
"error": {
158+
"root_cause": [
159+
{
160+
"type": "version_conflict_engine_exception",
161+
"reason": "[blog][1]: version conflict, current [2], provided [1]",
162+
"index": "website",
163+
"shard": "3"
164+
}
165+
],
166+
"type": "version_conflict_engine_exception",
167+
"reason": "[blog][1]: version conflict, current [2], provided [1]",
168+
"index": "website",
169+
"shard": "3"
170+
},
171+
"status": 409
160172
}
161173
--------------------------------------------------
162174
// SENSE: 030_Data/40_Concurrency.json

040_Distributed_CRUD/00_Intro.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ options that are discussed are for advanced users only.
1919
2020
Read the section to gain a taste for how things work, and to know where the
2121
information is in case you need to refer to it in the future, but don't be
22-
overwhelmed by the detail.
22+
overwhelmed by the details.
2323
2424
****
2525

040_Distributed_CRUD/30_Bulk_requests.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ The sequence of steps((("bulk API", "multiple document changes with")))((("docum
4747
the coordinating node, which collates the responses and returns them to the
4848
client.
4949

50-
The `bulk` API also ((("consistency request parameter", "in bulk requests"))) the `consistency` parameter
50+
The `bulk` API also accepts ((("consistency request parameter", "in bulk requests"))) the `consistency` parameter
5151
at the top level for the whole `bulk` request, and the `routing` parameter
5252
in the metadata for each request.

052_Mapping_Analysis/40_Analysis.asciidoc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,11 @@ parameters, and the text to analyze in the body:
159159

160160
[source,js]
161161
--------------------------------------------------
162-
GET /_analyze?analyzer=standard
163-
Text to analyze
162+
GET /_analyze
163+
{
164+
"analyzer": "standard",
165+
"text": "Text to analyze"
166+
}
164167
--------------------------------------------------
165168
// SENSE: 052_Mapping_Analysis/40_Analyze.json
166169

052_Mapping_Analysis/45_Mapping.asciidoc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ can contain one of three values:
144144
`analyzed`::
145145
First analyze the string and then index it. In other words, index this field as full text.
146146

147-
`not_analyzed`::
147+
`not_analyzed`::
148148
Index this field, so it is searchable, but index the value exactly as specified. Do not analyze it.
149149

150-
`no`::
150+
`no`::
151151
Don't index this field at all. This field will not be searchable.
152152

153153
The default value of `index` for a `string` field is `analyzed`. If we
@@ -204,7 +204,7 @@ for an existing type) later, using the `/_mapping` endpoint.
204204
================================================
205205
Although you can _add_ to an existing mapping, you can't _change_ existing
206206
field mappings. If a mapping already exists for a field, data from that
207-
field has probably been indexed. If you were to change the field mapping,
207+
field has probably been indexed. If you were to change the field mapping,
208208
the indexed data would be wrong and would not be properly searchable.
209209
================================================
210210

@@ -278,11 +278,17 @@ name. Compare the output of these two requests:
278278

279279
[source,js]
280280
--------------------------------------------------
281-
GET /gb/_analyze?field=tweet
282-
Black-cats <1>
281+
GET /gb/_analyze
282+
{
283+
"field": "tweet",
284+
"text": "Black-cats" <1>
285+
}
283286
284-
GET /gb/_analyze?field=tag
285-
Black-cats <1>
287+
GET /gb/_analyze
288+
{
289+
"field": "tag",
290+
"text": "Black-cats" <1>
291+
}
286292
--------------------------------------------------
287293
// SENSE: 052_Mapping_Analysis/45_Mapping.json
288294
<1> The text we want to analyze is passed in the body.

054_Query_DSL.asciidoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ include::054_Query_DSL/65_Queries_vs_filters.asciidoc[]
66

77
include::054_Query_DSL/70_Important_clauses.asciidoc[]
88

9-
include::054_Query_DSL/75_Queries_with_filters.asciidoc[]
9+
include::054_Query_DSL/75_Combining_queries_together.asciidoc[]
1010

1111
include::054_Query_DSL/80_Validating_queries.asciidoc[]
12-

054_Query_DSL/60_Query_DSL.asciidoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,17 @@ other to create complex queries. Clauses can be as follows:
9999

100100
* _Compound_ clauses that are used ((("compound query clauses")))to combine other query clauses.
101101
For instance, a `bool` clause((("bool clause"))) allows you to combine other clauses that
102-
either `must` match, `must_not` match, or `should` match if possible:
102+
either `must` match, `must_not` match, or `should` match if possible. They can also include non-scoring,
103+
filters for structured search:
103104

104105
[source,js]
105106
--------------------------------------------------
106107
{
107108
"bool": {
108109
"must": { "match": { "tweet": "elasticsearch" }},
109110
"must_not": { "match": { "name": "mary" }},
110-
"should": { "match": { "tweet": "full text" }}
111+
"should": { "match": { "tweet": "full text" }},
112+
"filter": { "range": { "age" : { "gt" : 30 }} }
111113
}
112114
}
113115
--------------------------------------------------

0 commit comments

Comments
 (0)