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
Although this format is really useful, it is not directly presentable to a final user. It is more dedicated to
26
+
applications which are in charge of the
27
+
The goal of these applications is to generate a graphic result of one or more documents for instance on HTML page. They need a specific executive environment (...) which is necessary to install, configure and maintain. as well as regular deliveries of the application when the graphic content of one document is modified.
24
28
25
29
Bien que très pratique, ce format n'est pas directement présentable à un utilisateur final. Il est plutot destiné à être
26
30
exploité par des applications tierces dont le rôle est de générer un rendu graphique d'un ou plusieurs documents, par
@@ -50,22 +54,19 @@ scripts prédéfinis, ou encore de créer une vue sur-mesure pour afficher le r
50
54
51
55
## Installing the plugin
52
56
53
-
|_. elasticsearch-view-plugin |_. ElasticSearch|
54
-
| master (0.0.1) | 0.20.1 |
55
-
56
-
In order to install the plugin, simply run:
57
+
The plugin can be installed as any other ElasticSearch's plugins:
ElasticSearch View Plugin uses the mapping's [meta data](http://www.elasticsearch.org/guide/reference/mapping/meta.html)
85
-
to store all the views that are associated with a specific document type. Each view has a unique name, a template language
86
-
and a template content.
86
+
to store all the views that are associated with a specific document type. Each view has a unique name, a scripting language,
87
+
a content and eventually a content type.
87
88
88
-
Be careful, as the [Update API](http://www.elasticsearch.org/guide/reference/api/update.html), the `_source` field need to be enabled for this feature to work.
89
+
Be careful, as the [Update API](http://www.elasticsearch.org/guide/reference/api/update.html), the `_source` field need
90
+
to be enabled for this feature to work.
89
91
90
-
Let's create a basic view using the [MVEL templating](http://mvel.codehaus.org/MVEL+2.0+Basic+Templating) language:
92
+
First, we can create a basic view using the [MVEL templating](http://mvel.codehaus.org/MVEL+2.0+Basic+Templating) language:
The previous command creates a view called `default`. The property `view_lang` can be used to specify the templating
108
110
engine to use (default is `mvel`) whereas the `view` property holds the content of the view. When needed, a specific `content_type`
109
-
can be set. The view named `default` will be used by default to render the documents of type `product`.
111
+
can be set. Note that the view named `default` will be used by default to render the documents of type `product`.
112
+
113
+
In MVEL, the coordinates of the document are available with `@{_id}`, `@{_type}` and `@{_index}` instructions. The original
114
+
`_source` of the document can be accessed with `@{_source._x_}` where _x_ is a document property name.
115
+
116
+
Now the view is created, opening the URL `http://localhost:9200/_view/catalog/product/1` in a web browser will trigger
117
+
the rendering of document with id 1. The result looks like:
110
118
111
-
Now the view is created, opening the URL `http://localhost:9200/_view/catalog/product/1` in a web browser will trigger the rendering of document with id 1.
119
+

112
120
113
-
The result looks like:
121
+
Simple, no?
114
122
115
-
imag render_default.png
116
123
117
124
### Using multiple views
118
125
119
-
Many views can be defined for the same type of document, allowing differents renderings of the same document:
126
+
In most use cases, a unique view is not sufficient. That's why the plugins allows to define many views for the same type of document,
127
+
allowing differents renderings of the same document:
This way, the URL `http://www.domain.com/catalog/list-of-products-by-size/1:10` points to `http://localhost:9200/_view/catalog/list-of-products-by-size/1:10`.
391
-
392
400
393
401
394
-
Hope this plugin will be as useful as it is for us :)
402
+
We hope that this plugin will be as useful for you as it is for us, and we welcome your feedback and comments about this new plugin.
0 commit comments