Skip to content

Commit 296b8fc

Browse files
committed
Doc: Reorganize overview and installation chapters
* [DOCS] Reorganizes Overview and Installation chapters. * [DOCS] Changes leveloffset. * [DOCS] Changes installed versions. Closes #185
1 parent 2cfab60 commit 296b8fc

File tree

3 files changed

+125
-66
lines changed

3 files changed

+125
-66
lines changed

.doc/index.asciidoc

Lines changed: 5 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,9 @@
1-
= go-elasticsearch
1+
= Elasticsearch Go Client
22

3-
== Overview
3+
:doctype: book
44

5-
An official Go client for Elasticsearch.
5+
include::{asciidoc-dir}/../../shared/attributes.asciidoc[]
66

7-
Full documentation is hosted at https://github.com/elastic/go-elasticsearch[GitHub]
8-
and https://godoc.org/github.com/elastic/go-elasticsearch[GoDoc]
9-
-- this page provides only an overview.
7+
include::overview.asciidoc[]
108

11-
=== Elasticsearch Version Compatibility
12-
13-
The client major versions correspond to the Elasticsearch major versions:
14-
to connect to Elasticsearch `6.x`, use a `6.x` version of the client,
15-
to connect to Elasticsearch `7.x`, use a `7.x` version of the client, and so on.
16-
17-
The `master` branch of the client is compatible with the `master` branch of Elasticsearch.
18-
19-
=== Installation
20-
21-
Add the package to your `go.mod` file:
22-
23-
[source,text]
24-
------------------------------------
25-
require github.com/elastic/go-elasticsearch/v7 7.x
26-
------------------------------------
27-
28-
=== Usage
29-
30-
[source,go]
31-
------------------------------------
32-
package main
33-
34-
import (
35-
"log"
36-
37-
"github.com/elastic/go-elasticsearch/v7"
38-
)
39-
40-
func main() {
41-
es, _ := elasticsearch.NewDefaultClient()
42-
log.Println(es.Info())
43-
}
44-
------------------------------------
45-
46-
[NOTE]
47-
Please have a look at the collection of comprehensive examples in the repository
48-
at https://github.com/elastic/go-elasticsearch/tree/master/_examples.
49-
50-
== Resources
51-
52-
* https://github.com/elastic/go-elasticsearch[Source Code]
53-
* https://godoc.org/github.com/elastic/go-elasticsearch[API Documentation]
54-
* https://github.com/elastic/go-elasticsearch/tree/master/_examples[Examples and Recipes]
55-
56-
== License
57-
58-
Copyright 2019 Elasticsearch
59-
60-
Licensed under the Apache License, Version 2.0 (the "License");
61-
you may not use this file except in compliance with the License.
62-
You may obtain a copy of the License at
63-
64-
http://www.apache.org/licenses/LICENSE-2.0
65-
66-
Unless required by applicable law or agreed to in writing, software
67-
distributed under the License is distributed on an "AS IS" BASIS,
68-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
69-
See the License for the specific language governing permissions and
70-
limitations under the License.
9+
include::installation.asciidoc[]

.doc/installation.asciidoc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[[installation]]
2+
== Installation
3+
4+
To install the 7.x version of the client, add the package to your `go.mod` file:
5+
6+
[source,text]
7+
------------------------------------
8+
require github.com/elastic/go-elasticsearch/v7 7.x
9+
------------------------------------
10+
11+
Or, clone the repository:
12+
13+
[source,text]
14+
------------------------------------
15+
git clone --branch 7.x https://github.com/elastic/go-elasticsearch.git $GOPATH/src/github
16+
------------------------------------
17+
18+
To install another version, modify the path or the branch name accordingly. The
19+
client major versions correspond to the {es} major versions.
20+
21+
You can find a complete example of installation below:
22+
23+
[source,text]
24+
------------------------------------
25+
mkdir my-elasticsearch-app && cd my-elasticsearch-app
26+
27+
cat > go.mod <<-END
28+
module my-elasticsearch-app
29+
30+
require github.com/elastic/go-elasticsearch/v8 master
31+
END
32+
33+
cat > main.go <<-END
34+
package main
35+
36+
import (
37+
"log"
38+
39+
"github.com/elastic/go-elasticsearch/v8"
40+
)
41+
42+
func main() {
43+
es, _ := elasticsearch.NewDefaultClient()
44+
log.Println(elasticsearch.Version)
45+
log.Println(es.Info())
46+
}
47+
END
48+
49+
go run main.go
50+
------------------------------------

.doc/overview.asciidoc

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
[[overview]]
2+
== Overview
3+
4+
This is the official Go client for {es}.
5+
6+
Full documentation is hosted at
7+
https://github.com/elastic/go-elasticsearch[GitHub]
8+
and https://godoc.org/github.com/elastic/go-elasticsearch[GoDoc]. This
9+
documentation provides only an overview of features.
10+
11+
12+
[discrete]
13+
=== {es} Version Compatibility
14+
15+
The client major versions correspond to the {es} major versions:
16+
to connect to {es} `6.x`, use a `6.x` version of the client,
17+
to connect to {es} `7.x`, use a `7.x` version of the client, and so on.
18+
19+
The `master` branch of the client is compatible with the `master` branch of
20+
{es}.
21+
22+
23+
[discrete]
24+
=== Usage
25+
26+
[source,go]
27+
------------------------------------
28+
package main
29+
30+
import (
31+
"log"
32+
33+
"github.com/elastic/go-elasticsearch/v7"
34+
)
35+
36+
func main() {
37+
es, _ := elasticsearch.NewDefaultClient()
38+
log.Println(es.Info())
39+
}
40+
------------------------------------
41+
42+
[NOTE]
43+
Please have a look at the collection of comprehensive examples in the repository
44+
at https://github.com/elastic/go-elasticsearch/tree/master/_examples.
45+
46+
47+
[discrete]
48+
=== Resources
49+
50+
* https://github.com/elastic/go-elasticsearch[Source Code]
51+
* https://godoc.org/github.com/elastic/go-elasticsearch[API Documentation]
52+
* https://github.com/elastic/go-elasticsearch/tree/master/_examples[Examples and Recipes]
53+
54+
55+
[discrete]
56+
=== License
57+
58+
Copyright 2019 {es}.
59+
60+
Licensed under the Apache License, Version 2.0 (the "License");
61+
you may not use this file except in compliance with the License.
62+
You may obtain a copy of the License at
63+
64+
http://www.apache.org/licenses/LICENSE-2.0
65+
66+
Unless required by applicable law or agreed to in writing, software
67+
distributed under the License is distributed on an "AS IS" BASIS,
68+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
69+
See the License for the specific language governing permissions and
70+
limitations under the License.

0 commit comments

Comments
 (0)