Skip to content

Commit 612b7da

Browse files
Merge remote-tracking branch 'upstream/master' into unsigned64bits_integer
2 parents 7eb2d4a + 74bad18 commit 612b7da

File tree

2,462 files changed

+49524
-29949
lines changed

Some content is hidden

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

2,462 files changed

+49524
-29949
lines changed

.ci/bwcVersions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ BWC_VERSION:
2222
- "7.8.0"
2323
- "7.8.1"
2424
- "7.9.0"
25+
- "7.9.1"
2526
- "7.10.0"
2627
- "8.0.0"

.ci/os.sh

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ cp -v .ci/init.gradle $HOME/.gradle/init.d
3131

3232
unset JAVA_HOME
3333

34-
if ! [ -e "/usr/bin/bats" ] ; then
35-
git clone https://github.com/sstephenson/bats /tmp/bats
36-
sudo /tmp/bats/install.sh /usr
37-
fi
38-
39-
4034
if [ -f "/etc/os-release" ] ; then
4135
cat /etc/os-release
4236
. /etc/os-release
@@ -54,16 +48,8 @@ else
5448
fi
5549

5650
sudo bash -c 'cat > /etc/sudoers.d/elasticsearch_vars' << SUDOERS_VARS
57-
Defaults env_keep += "ZIP"
58-
Defaults env_keep += "TAR"
59-
Defaults env_keep += "RPM"
60-
Defaults env_keep += "DEB"
61-
Defaults env_keep += "PACKAGING_ARCHIVES"
62-
Defaults env_keep += "PACKAGING_TESTS"
63-
Defaults env_keep += "BATS_UTILS"
64-
Defaults env_keep += "BATS_TESTS"
65-
Defaults env_keep += "SYSTEM_JAVA_HOME"
6651
Defaults env_keep += "JAVA_HOME"
52+
Defaults env_keep += "SYSTEM_JAVA_HOME"
6753
SUDOERS_VARS
6854
sudo chmod 0440 /etc/sudoers.d/elasticsearch_vars
6955

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ You will need to fork the main Elasticsearch code or documentation repository an
5555

5656
Further instructions for specific projects are given below.
5757

58+
### Tips for code changes
59+
Following these tips prior to raising a pull request will speed up the review
60+
cycle.
61+
62+
* Add appropriate unit tests (details on writing tests can be found in the
63+
[TESTING](TESTING.asciidoc) file)
64+
* Add integration tests, if applicable
65+
* Make sure the code you add follows the [formatting guidelines](#java-language-formatting-guidelines)
66+
* Lines that are not part of your change should not be edited (e.g. don't format
67+
unchanged lines, don't reorder existing imports)
68+
* Add the appropriate [license headers](#license-headers) to any new files
69+
5870
### Submitting your changes
5971

6072
Once your changes and tests are ready to submit for review:

README.asciidoc

Lines changed: 63 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -35,154 +35,148 @@ First of all, DON'T PANIC. It will take 5 minutes to get the gist of what Elasti
3535

3636
* https://www.elastic.co/downloads/elasticsearch[Download] and unpack the Elasticsearch official distribution.
3737
* Run `bin/elasticsearch` on Linux or macOS. Run `bin\elasticsearch.bat` on Windows.
38-
* Run `curl -X GET http://localhost:9200/`.
39-
* Start more servers ...
38+
* Run `curl -X GET http://localhost:9200/` to verify Elasticsearch is running.
4039

4140
=== Indexing
4241

43-
Let's try and index some twitter like information. First, let's index some tweets (the `twitter` index will be created automatically):
42+
First, index some sample JSON documents. The first request automatically creates
43+
the `my-index-000001` index.
4444

4545
----
46-
curl -XPUT 'http://localhost:9200/twitter/_doc/1?pretty' -H 'Content-Type: application/json' -d '
46+
curl -X POST 'http://localhost:9200/my-index-000001/_doc?pretty' -H 'Content-Type: application/json' -d '
4747
{
48-
"user": "kimchy",
49-
"post_date": "2009-11-15T13:12:00",
50-
"message": "Trying out Elasticsearch, so far so good?"
48+
"@timestamp": "2099-11-15T13:12:00",
49+
"message": "GET /search HTTP/1.1 200 1070000",
50+
"user": {
51+
"id": "kimchy"
52+
}
5153
}'
5254
53-
curl -XPUT 'http://localhost:9200/twitter/_doc/2?pretty' -H 'Content-Type: application/json' -d '
55+
curl -X POST 'http://localhost:9200/my-index-000001/_doc?pretty' -H 'Content-Type: application/json' -d '
5456
{
55-
"user": "kimchy",
56-
"post_date": "2009-11-15T14:12:12",
57-
"message": "Another tweet, will it be indexed?"
57+
"@timestamp": "2099-11-15T14:12:12",
58+
"message": "GET /search HTTP/1.1 200 1070000",
59+
"user": {
60+
"id": "elkbee"
61+
}
5862
}'
5963
60-
curl -XPUT 'http://localhost:9200/twitter/_doc/3?pretty' -H 'Content-Type: application/json' -d '
64+
curl -X POST 'http://localhost:9200/my-index-000001/_doc?pretty' -H 'Content-Type: application/json' -d '
6165
{
62-
"user": "elastic",
63-
"post_date": "2010-01-15T01:46:38",
64-
"message": "Building the site, should be kewl"
66+
"@timestamp": "2099-11-15T01:46:38",
67+
"message": "GET /search HTTP/1.1 200 1070000",
68+
"user": {
69+
"id": "elkbee"
70+
}
6571
}'
6672
----
6773

68-
Now, let's see if the information was added by GETting it:
74+
=== Search
6975

70-
----
71-
curl -XGET 'http://localhost:9200/twitter/_doc/1?pretty=true'
72-
curl -XGET 'http://localhost:9200/twitter/_doc/2?pretty=true'
73-
curl -XGET 'http://localhost:9200/twitter/_doc/3?pretty=true'
74-
----
75-
76-
=== Searching
77-
78-
Mmm search..., shouldn't it be elastic?
79-
Let's find all the tweets that `kimchy` posted:
76+
Next, use a search request to find any documents with a `user.id` of `kimchy`.
8077

8178
----
82-
curl -XGET 'http://localhost:9200/twitter/_search?q=user:kimchy&pretty=true'
79+
curl -X GET 'http://localhost:9200/my-index-000001/_search?q=user.id:kimchy&pretty=true'
8380
----
8481

85-
We can also use the JSON query language Elasticsearch provides instead of a query string:
82+
Instead of a query string, you can use Elasticsearch's
83+
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html[Query
84+
DSL] in the request body.
8685

8786
----
88-
curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -H 'Content-Type: application/json' -d '
87+
curl -X GET 'http://localhost:9200/my-index-000001/_search?pretty=true' -H 'Content-Type: application/json' -d '
8988
{
9089
"query" : {
91-
"match" : { "user": "kimchy" }
90+
"match" : { "user.id": "kimchy" }
9291
}
9392
}'
9493
----
9594

96-
Just for kicks, let's get all the documents stored (we should see the tweet from `elastic` as well):
95+
You can also retrieve all documents in `my-index-000001`.
9796

9897
----
99-
curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -H 'Content-Type: application/json' -d '
98+
curl -X GET 'http://localhost:9200/my-index-000001/_search?pretty=true' -H 'Content-Type: application/json' -d '
10099
{
101100
"query" : {
102101
"match_all" : {}
103102
}
104103
}'
105104
----
106105

107-
We can also do range search (the `post_date` was automatically identified as date)
106+
During indexing, Elasticsearch automatically mapped the `@timestamp` field as a
107+
date. This lets you run a range search.
108108

109109
----
110-
curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -H 'Content-Type: application/json' -d '
110+
curl -X GET 'http://localhost:9200/my-index-000001/_search?pretty=true' -H 'Content-Type: application/json' -d '
111111
{
112112
"query" : {
113113
"range" : {
114-
"post_date" : { "from" : "2009-11-15T13:00:00", "to" : "2009-11-15T14:00:00" }
114+
"@timestamp": {
115+
"from": "2099-11-15T13:00:00",
116+
"to": "2099-11-15T14:00:00"
117+
}
115118
}
116119
}
117120
}'
118121
----
119122

120-
There are many more options to perform search, after all, it's a search product no? All the familiar Lucene queries are available through the JSON query language, or through the query parser.
121-
122-
=== Multi Tenant and Indices
123-
124-
Man, that twitter index might get big (in this case, index size == valuation). Let's see if we can structure our twitter system a bit differently in order to support such large amounts of data.
123+
=== Multiple indices
125124

126-
Elasticsearch supports multiple indices. In the previous example we used an index called `twitter` that stored tweets for every user.
125+
Elasticsearch supports multiple indices. The previous examples used an index
126+
called `my-index-000001`. You can create another index, `my-index-000002`, to
127+
store additional data when `my-index-000001` reaches a certain age or size. You
128+
can also use separate indices to store different types of data.
127129

128-
Another way to define our simple twitter system is to have a different index per user (note, though that each index has an overhead). Here is the indexing curl's in this case:
130+
You can configure each index differently. The following request
131+
creates `my-index-000002` with two primary shards rather than the default of
132+
one. This may be helpful for larger indices.
129133

130134
----
131-
curl -XPUT 'http://localhost:9200/kimchy/_doc/1?pretty' -H 'Content-Type: application/json' -d '
135+
curl -X PUT 'http://localhost:9200/my-index-000002?pretty' -H 'Content-Type: application/json' -d '
132136
{
133-
"user": "kimchy",
134-
"post_date": "2009-11-15T13:12:00",
135-
"message": "Trying out Elasticsearch, so far so good?"
136-
}'
137-
138-
curl -XPUT 'http://localhost:9200/kimchy/_doc/2?pretty' -H 'Content-Type: application/json' -d '
139-
{
140-
"user": "kimchy",
141-
"post_date": "2009-11-15T14:12:12",
142-
"message": "Another tweet, will it be indexed?"
137+
"settings" : {
138+
"index.number_of_shards" : 2
139+
}
143140
}'
144141
----
145142

146-
The above will index information into the `kimchy` index. Each user will get their own special index.
147-
148-
Complete control on the index level is allowed. As an example, in the above case, we might want to change from the default 1 shard with 1 replica per index, to 2 shards with 1 replica per index (because this user tweets a lot). Here is how this can be done (the configuration can be in yaml as well):
143+
You can then add a document to `my-index-000002`.
149144

150145
----
151-
curl -XPUT http://localhost:9200/another_user?pretty -H 'Content-Type: application/json' -d '
146+
curl -X POST 'http://localhost:9200/my-index-000002/_doc?pretty' -H 'Content-Type: application/json' -d '
152147
{
153-
"settings" : {
154-
"index.number_of_shards" : 2,
155-
"index.number_of_replicas" : 1
148+
"@timestamp": "2099-11-16T13:12:00",
149+
"message": "GET /search HTTP/1.1 200 1070000",
150+
"user": {
151+
"id": "kimchy"
156152
}
157153
}'
158154
----
159155

160-
Search (and similar operations) are multi index aware. This means that we can easily search on more than one
161-
index (twitter user), for example:
156+
You can search and perform other operations on multiple indices with a single
157+
request. The following request searches `my-index-000001` and `my-index-000002`.
162158

163159
----
164-
curl -XGET 'http://localhost:9200/kimchy,another_user/_search?pretty=true' -H 'Content-Type: application/json' -d '
160+
curl -X GET 'http://localhost:9200/my-index-000001,my-index-000002/_search?pretty=true' -H 'Content-Type: application/json' -d '
165161
{
166162
"query" : {
167163
"match_all" : {}
168164
}
169165
}'
170166
----
171167

172-
Or on all the indices:
168+
You can omit the index from the request path to search all indices.
173169

174170
----
175-
curl -XGET 'http://localhost:9200/_search?pretty=true' -H 'Content-Type: application/json' -d '
171+
curl -X GET 'http://localhost:9200/_search?pretty=true' -H 'Content-Type: application/json' -d '
176172
{
177173
"query" : {
178174
"match_all" : {}
179175
}
180176
}'
181177
----
182178

183-
And the cool part about that? You can easily search on multiple twitter users (indices), with different boost levels per user (index), making social search so much simpler (results from my friends rank higher than results from friends of my friends).
184-
185-
=== Distributed, Highly Available
179+
=== Distributed, highly available
186180

187181
Let's face it, things will fail....
188182

@@ -194,7 +188,7 @@ In order to play with the distributed nature of Elasticsearch, simply bring more
194188

195189
We have just covered a very small portion of what Elasticsearch is all about. For more information, please refer to the https://www.elastic.co/products/elasticsearch[elastic.co] website. General questions can be asked on the https://discuss.elastic.co[Elastic Forum] or https://ela.st/slack[on Slack]. The Elasticsearch GitHub repository is reserved for bug reports and feature requests only.
196190

197-
=== Building from Source
191+
=== Building from source
198192

199193
Elasticsearch uses https://gradle.org[Gradle] for its build system.
200194

Vagrantfile

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def sles_common(config, name)
333333
zypper ar http://download.opensuse.org/distribution/12.3/repo/oss/ oss
334334
zypper --non-interactive --gpg-auto-import-keys refresh
335335
zypper --non-interactive install git-core
336-
# choose to "ignore some dependencies" of expect, which has a problem with tcl...
336+
# choose to "ignore some dependencies" of expect, which has a problem with tcl...
337337
zypper --non-interactive install --force-resolution expect
338338
SHELL
339339
suse_common config, name, extra: extra
@@ -465,38 +465,13 @@ def sh_install_deps(config,
465465
466466
#{extra}
467467
468-
installed java || {
469-
echo "==> Java is not installed"
470-
return 1
471-
}
472-
cat \<\<JAVA > /etc/profile.d/java_home.sh
473-
if [ ! -z "\\\$JAVA_HOME" ]; then
474-
export SYSTEM_JAVA_HOME=\\\$JAVA_HOME
475-
unset JAVA_HOME
476-
fi
477-
JAVA
478468
ensure tar
479469
ensure curl
480470
ensure unzip
481471
ensure rsync
482472
ensure expect
483473
484-
installed bats || {
485-
# Bats lives in a git repository....
486-
ensure git
487-
echo "==> Installing bats"
488-
git clone https://github.com/sstephenson/bats /tmp/bats
489-
# Centos doesn't add /usr/local/bin to the path....
490-
/tmp/bats/install.sh /usr
491-
rm -rf /tmp/bats
492-
}
493-
494474
cat \<\<SUDOERS_VARS > /etc/sudoers.d/elasticsearch_vars
495-
Defaults env_keep += "BATS_UTILS"
496-
Defaults env_keep += "BATS_TESTS"
497-
Defaults env_keep += "BATS_PLUGINS"
498-
Defaults env_keep += "BATS_UPGRADE"
499-
Defaults env_keep += "PACKAGE_NAME"
500475
Defaults env_keep += "JAVA_HOME"
501476
Defaults env_keep += "SYSTEM_JAVA_HOME"
502477
SUDOERS_VARS
@@ -505,21 +480,9 @@ SUDOERS_VARS
505480
end
506481

507482
def windows_common(config, name)
508-
config.vm.provision 'markerfile', type: 'shell', inline: <<-SHELL
509-
$ErrorActionPreference = "Stop"
510-
New-Item C:/is_vagrant_vm -ItemType file -Force | Out-Null
511-
SHELL
512-
513483
config.vm.provision 'set prompt', type: 'shell', inline: <<-SHELL
514484
$ErrorActionPreference = "Stop"
515485
$ps_prompt = 'function Prompt { "#{name}:$($ExecutionContext.SessionState.Path.CurrentLocation)>" }'
516486
$ps_prompt | Out-File $PsHome/Microsoft.PowerShell_profile.ps1
517487
SHELL
518-
519-
config.vm.provision 'set env variables', type: 'shell', inline: <<-SHELL
520-
$ErrorActionPreference = "Stop"
521-
[Environment]::SetEnvironmentVariable("PACKAGING_ARCHIVES", "C:/project/build/packaging/archives", "Machine")
522-
[Environment]::SetEnvironmentVariable("PACKAGING_TESTS", "C:/project/build/packaging/tests", "Machine")
523-
[Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "Machine")
524-
SHELL
525488
end

benchmarks/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,29 @@ To get realistic results, you should exercise care when running benchmarks. Here
6363
* Blindly believe the numbers that your microbenchmark produces but verify them by measuring e.g. with `-prof perfasm`.
6464
* Run more threads than your number of CPU cores (in case you run multi-threaded microbenchmarks).
6565
* Look only at the `Score` column and ignore `Error`. Instead take countermeasures to keep `Error` low / variance explainable.
66+
67+
## Disassembling
68+
69+
Disassembling is fun! Maybe not always useful, but always fun! Generally, you'll want to install `perf` and FCML's `hsdis`.
70+
`perf` is generally available via `apg-get install perf` or `pacman -S perf`. FCML is a little more involved. This worked
71+
on 2020-08-01:
72+
73+
```
74+
wget https://github.com/swojtasiak/fcml-lib/releases/download/v1.2.2/fcml-1.2.2.tar.gz
75+
tar xf fcml*
76+
cd fcml*
77+
./configure
78+
make
79+
cd example/hsdis
80+
make
81+
cp .libs/libhsdis.so.0.0.0
82+
sudo cp .libs/libhsdis.so.0.0.0 /usr/lib/jvm/java-14-adoptopenjdk/lib/hsdis-amd64.so
83+
```
84+
85+
If you want to disassemble a single method do something like this:
86+
87+
```
88+
gradlew -p benchmarks run --args ' MemoryStatsBenchmark -jvmArgs "-XX:+UnlockDiagnosticVMOptions -XX:CompileCommand=print,*.yourMethodName -XX:PrintAssemblyOptions=intel"
89+
```
90+
91+
If you want `perf` to find the hot methods for you then do add `-prof:perfasm`.

buildSrc/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ dependencies {
9999
api 'com.netflix.nebula:gradle-info-plugin:7.1.3'
100100
api 'org.apache.rat:apache-rat:0.11'
101101
api "org.elasticsearch:jna:5.5.0"
102-
api 'com.github.jengelman.gradle.plugins:shadow:5.1.0'
102+
api 'com.github.jengelman.gradle.plugins:shadow:6.0.0'
103103
api 'de.thetaphi:forbiddenapis:3.0'
104104
api 'com.avast.gradle:gradle-docker-compose-plugin:0.12.1'
105105
api 'org.apache.maven:maven-model:3.6.2'

0 commit comments

Comments
 (0)