Skip to content

Commit 9118bb8

Browse files
committed
[TASK] Adjust configuration docs for Elasticsearch versions
The documentation contains configuration hints/examples for Elasticsearch up to 1.4. This changes the documentation to state that versions up to 1.7 are actually working and provides configuration examples for later versions as well.
1 parent c688779 commit 9118bb8

1 file changed

Lines changed: 56 additions & 32 deletions

File tree

README.md

Lines changed: 56 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[![Build Status](https://travis-ci.org/Flowpack/Flowpack.ElasticSearch.ContentRepositoryAdaptor.svg)](https://travis-ci.org/Flowpack/Flowpack.ElasticSearch.ContentRepositoryAdaptor)
22

3-
# Neos ElasticSearch Adapter
3+
# Neos Elasticsearch Adapter
44

5-
*supporting ElasticSearch Version 1.2.x and 1.3.x and 1.4.x*
5+
*supporting Elasticsearch versions 1.2.x to 1.7.x*
66

7-
Created by Sebastian Kurfürst; contributions by Karsten Dambekalns and Robert Lemke.
7+
Created by Sebastian Kurfürst; [contributions by Karsten Dambekalns, Robert Lemke and others](https://github.com/Flowpack/Flowpack.ElasticSearch.ContentRepositoryAdaptor/graphs/contributors).
88

9-
This project connects the Neos Content Repository (TYPO3CR) to ElasticSearch; enabling two
9+
This project connects the Neos Content Repository (TYPO3CR) to Elasticsearch; enabling two
1010
main functionalities:
1111

1212
* finding Nodes in TypoScript / Eel by arbitrary queries
@@ -39,17 +39,41 @@ composer require 'flowpack/searchplugin:@dev'
3939
Now, add the routes as described in the [README of Flowpack.SearchPlugin](https://github.com/skurfuerst/Flowpack.SearchPlugin)
4040
as the **first route** in Configuration/Routes.yaml.
4141

42-
Then, ensure to update `<your-elasticsearch>/config/elasticsearch.yml` as explained below; then start ElasticSearch.
42+
Then, ensure to update `<your-elasticsearch>/config/elasticsearch.yml` as explained below; then start Elasticsearch.
4343

4444
Finally, run `./flow nodeindex:build`, and add the search plugin to your page. It should "just work".
4545

46-
## ElasticSearch Configuration file elasticsearch.yml
46+
## Elasticsearch Configuration file elasticsearch.yml
4747

48-
Due to the fact that the default scripting language has changed from marvel to groovy since elasticsearch 1.3.0,
49-
there is a need, depending on your running installation of ElasticSearch, to add following lines of configuration to your
50-
ElasticSearch Configuration File `<your-elasticsearch>/config/elasticsearch.yml`.
48+
There is a need, depending on your version of Elasticsearch, to add the following lines of configuration to your
49+
Elasticsearch Configuration File `<your-elasticsearch>/config/elasticsearch.yml`.
5150

52-
### Needed Configuration in configuration.yml for ElasticSearch 1.4.x
51+
### Needed Configuration in configuration.yml for Elasticsearch 1.6.x and 1.7.x
52+
53+
In verson 1.6 the `script.disable_dynamic` settings and the Groovy sandbox as such [have been deprecated]
54+
(https://www.elastic.co/guide/en/elasticsearch/reference/1.6/modules-scripting.html#enable-dynamic-scripting).
55+
You may continue to use the settings for version 1.5.x, but this is what would be the correct configuration for 1.6.x and 1.7.x.
56+
57+
```
58+
# The following settings are absolutely required for the CR adaptor to work
59+
script.file: on
60+
script.engine.groovy.inline: sandbox
61+
script.engine.groovy.indexed: sandbox
62+
63+
script.groovy.sandbox.class_whitelist: java.util.LinkedHashMap
64+
script.groovy.sandbox.receiver_whitelist: java.util.Iterator, java.lang.Object, java.util.Map, java.util.Map$Entry
65+
script.groovy.sandbox.enabled: true
66+
67+
# the following settings secure your cluster
68+
cluster.name: [PUT_YOUR_CUSTOM_NAME_HERE]
69+
network.host: 127.0.0.1
70+
71+
# the following settings are well-suited for smaller Elasticsearch instances (e.g. as long as you can stay on one host)
72+
index.number_of_shards: 1
73+
index.number_of_replicas: 0
74+
```
75+
76+
### Needed Configuration in configuration.yml for Elasticsearch 1.4.x and 1.5.x
5377

5478
```
5579
# The following settings are absolutely required for the CR adaptor to work
@@ -62,12 +86,12 @@ script.groovy.sandbox.enabled: true
6286
cluster.name: [PUT_YOUR_CUSTOM_NAME_HERE]
6387
network.host: 127.0.0.1
6488
65-
# the following settings are well-suited for smaller ElasticSearch instances (e.g. as long as you can stay on one host)
89+
# the following settings are well-suited for smaller Elasticsearch instances (e.g. as long as you can stay on one host)
6690
index.number_of_shards: 1
6791
index.number_of_replicas: 0
6892
```
6993

70-
### Needed Configuration in configuration.yml for ElasticSearch 1.3.x
94+
### Needed Configuration in configuration.yml for Elasticsearch 1.3.x
7195

7296
```
7397
# The following settings are absolutely required for the CR adaptor to work
@@ -78,7 +102,7 @@ script.groovy.sandbox.receiver_whitelist: java.util.Iterator, java.lang.Object,
78102
cluster.name: [PUT_YOUR_CUSTOM_NAME_HERE]
79103
network.host: 127.0.0.1
80104
81-
# the following settings are well-suited for smaller ElasticSearch instances (e.g. as long as you can stay on one host)
105+
# the following settings are well-suited for smaller Elasticsearch instances (e.g. as long as you can stay on one host)
82106
index.number_of_shards: 1
83107
index.number_of_replicas: 0
84108
```
@@ -89,10 +113,10 @@ http://www.elasticsearch.org/blog/elasticsearch-1-3-0-released/
89113
http://www.elasticsearch.org/blog/scripting-security/
90114
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html
91115

92-
## Needed Configuration for ElasticSearch 1.2.x
116+
## Needed Configuration for Elasticsearch 1.2.x
93117

94118

95-
If you are using ElasticSearch version 1.2 you have also to install groovy as a plugin. To install the plugin just run
119+
If you are using Elasticsearch version 1.2 you have also to install groovy as a plugin. To install the plugin just run
96120
the following command in the root folder of your elastic:
97121

98122
```
@@ -157,11 +181,11 @@ If you use multiple client configurations, please change the *default* key just
157181

158182
## Doing Arbitrary Queries
159183

160-
We'll first show how to do arbitrary ElasticSearch Queries in TypoScript. This is a more powerful
184+
We'll first show how to do arbitrary Elasticsearch Queries in TypoScript. This is a more powerful
161185
alternative to FlowQuery. In the long run, we might be able to integrate this API back into FlowQuery,
162186
but for now it works well as-is.
163187

164-
Generally, ElasticSearch queries are done using the `Search` Eel helper. In case you want
188+
Generally, Elasticsearch queries are done using the `Search` Eel helper. In case you want
165189
to retrieve a *list of nodes*, you'll generally do:
166190
```
167191
nodes = ${Search.query(site)....execute()}
@@ -189,17 +213,17 @@ Furthermore, the following operators are supported:
189213
* `lessThan('propertyName', value)` -- range filter with property values less than the given value
190214
* `lessThanOrEqual('propertyName', value)` -- range filter with property values less than or equal to the given value
191215
* `sortAsc('propertyName')` and `sortDesc('propertyName')` -- can also be used multiple times, e.g. `sortAsc('tag').sortDesc(`date')` will first sort by tag ascending, and then by date descending.
192-
* `limit(5)` -- only return five results. If not specified, the default limit by ElasticSearch applies (which is at 10 by default)
216+
* `limit(5)` -- only return five results. If not specified, the default limit by Elasticsearch applies (which is at 10 by default)
193217
* `from(5)` -- return the results starting from the 6th one
194218
* `fulltext(...)` -- do a query_string query on the Fulltext Index
195219

196-
Furthermore, there is a more low-level operator which can be used to add arbitrary ElasticSearch filters:
220+
Furthermore, there is a more low-level operator which can be used to add arbitrary Elasticsearch filters:
197221

198222
* `queryFilter("filterType", {option1: "value1"})`
199223

200224
In order to debug the query more easily, the following operation is helpful:
201225

202-
* `log()` log the full query on execution into the ElasticSearch log (i.e. in `Data/Logs/ElasticSearch.log`)
226+
* `log()` log the full query on execution into the Elasticsearch log (i.e. in `Data/Logs/ElasticSearch.log`)
203227

204228
### Example Queries
205229

@@ -233,7 +257,7 @@ prototype(Acme.Blog:SingleTag) < prototype(TYPO3.Neos:Template) {
233257

234258
## Aggregations
235259

236-
Aggregation is an easy way to aggregate your node data in different ways. ElasticSearch provides a couple of different types of
260+
Aggregation is an easy way to aggregate your node data in different ways. Elasticsearch provides a couple of different types of
237261
aggregations. Check `https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html` for more
238262
info about aggregations. You can use them to get some simple aggregations like min, max or average values for
239263
your node data. Aggregations also allows you to build a complex filter for e.g. a product search or statistics.
@@ -332,7 +356,7 @@ be fetched and passed to your template.
332356

333357
**Important notice**
334358

335-
If you do use the terms filter be aware of ElasticSearchs analyze functionality. You might want to disable this for all
359+
If you do use the terms filter be aware of Elasticsearchs analyze functionality. You might want to disable this for all
336360
your filterable properties like this:
337361
```
338362
'Vendor.Name:Product'
@@ -362,7 +386,7 @@ a match inside the normal body text. That's why the `Document` node not only con
362386
all the texts, but multiple "buckets" where text is added to: One field which contains everything
363387
deemed as "very important" (`__fulltext.h1`), one which is "less important" (`__fulltext.h2`),
364388
and finally one for the plain text (`__fulltext.text`). All of these fields add themselves to the
365-
ElasticSearch `_all` field, and are configured with different `boost` values.
389+
Elasticsearch `_all` field, and are configured with different `boost` values.
366390

367391
In order to search this index, you can just search inside the `_all` field with an additional limitation
368392
of `__typeAndSupertypes` containing `TYPO3.Neos:Document`.
@@ -381,7 +405,7 @@ Furthermore, this can be overridden using the `properties.[....].search` path in
381405

382406
This configuration contains two parts:
383407

384-
* Underneath `elasticSearchMapping`, the ElasticSearch property mapping can be defined.
408+
* Underneath `elasticSearchMapping`, the Elasticsearch property mapping can be defined.
385409
* Underneath `indexing`, an Eel expression which processes the value before indexing has to be
386410
specified. It has access to the current `value` and the current `node`.
387411

@@ -410,7 +434,7 @@ TYPO3:
410434
search:
411435
412436
# a date should be mapped differently, and in this case we want to use a date format which
413-
# ElasticSearch understands
437+
# Elasticsearch understands
414438
elasticSearchMapping:
415439
type: DateTime
416440
include_in_all: false
@@ -473,7 +497,7 @@ An example:
473497

474498
## Working with Dates
475499

476-
As a default, ElasticSearch indexes dates in the UTC Timezone. In order to have it index using the timezone
500+
As a default, Elasticsearch indexes dates in the UTC Timezone. In order to have it index using the timezone
477501
currently configured in PHP, the configuration for any property in a node which represents a date should look like this:
478502

479503
```
@@ -490,13 +514,13 @@ currently configured in PHP, the configuration for any property in a node which
490514
This is important so that Date- and Time-based searches work as expected, both when using formatted DateTime strings and
491515
when using relative DateTime calculations (eg.: `now`, `now+1d`).
492516

493-
For more information on ElasticSearch's Date Formats,
517+
For more information on Elasticsearch's Date Formats,
494518
[click here](http://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html).
495519

496520

497521
## Working with Assets / Attachments
498522

499-
If you want to index attachments, you need to install the [ElasticSearch Attachment Plugin](https://github.com/elastic/elasticsearch-mapper-attachments).
523+
If you want to index attachments, you need to install the [Elasticsearch Attachment Plugin](https://github.com/elastic/elasticsearch-mapper-attachments).
500524
Then, you can add the following to your `Settings.yaml`:
501525

502526
```
@@ -517,7 +541,7 @@ TYPO3:
517541
indexing: ${Indexing.indexAsset(value)}
518542
```
519543

520-
## Configurable ElasticSearch Mapping
544+
## Configurable Elasticsearch Mapping
521545

522546
(included in version >= 2.1)
523547

@@ -562,14 +586,14 @@ in the NodeTypes.yaml. Generally this works by defining the global mapping at `[
562586

563587
In order to understand what's going on, the following commands are helpful:
564588

565-
* use `./flow nodeindex:showMapping` to show the currently defined ElasticSearch Mapping
566-
* use the `.log()` statement inside queries to dump them to the ElasticSearch Log
589+
* use `./flow nodeindex:showMapping` to show the currently defined Elasticsearch Mapping
590+
* use the `.log()` statement inside queries to dump them to the Elasticsearch Log
567591
* the logfile `Data/Logs/ElasticSearch.log` contains loads of helpful information.
568592

569593

570594
## Version 2 vs Version 1
571595

572-
* Version 1 is the initial, productive version of the Neos ElasticSearch adapter.
596+
* Version 1 is the initial, productive version of the Neos Elasticsearch adapter.
573597
* Version 2 has a dependency on TYPO3.TYPO3CR.Search; which contains base functionality
574598
which is also relevant for other search implementations (like the SQLite based SimpleSearch).
575599

0 commit comments

Comments
 (0)