index.rst 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. Elasticsearch data store
  2. ==================================
  3. Elasticsearch is a popular distributed search and analytics engine that enables complex search features in near real-time. Default field type mappings support string, numeric, boolean and date types and allow complex, hierarchical documents. Custom field type mappings can be defined for geospatial document fields. The ``geo_point`` type supports point geometries that can be specified through a coordinate string, geohash or coordinate array. The ``geo_shape`` type supports Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon and GeometryCollection GeoJSON types as well as envelope and circle types. Custom options allow configuration of the type and precision of the spatial index.
  4. This data store allows features from an Elasticsearch index to be published through GeoServer. Both ``geo_point`` and ``geo_shape`` type mappings are supported. OGC filters are converted to Elasticsearch queries and can be combined with native Elasticsearch queries in WMS and WFS requests.
  5. .. contents:: Contents:
  6. Configuration
  7. -------------
  8. .. _config_elasticsearch:
  9. Configuring data store
  10. ^^^^^^^^^^^^^^^^^^^^^^
  11. Once the Elasticsearch GeoServer extension is installed, ``Elasticsearch index`` will be an available vector data source format when creating a new data store.
  12. .. |new_store| image:: images/elasticsearch_store.png
  13. :scale: 100%
  14. :align: middle
  15. +-------------+
  16. | |new_store| |
  17. +-------------+
  18. The Elasticsearch data store configuration panel includes connection parameters and search settings.
  19. .. |store_config| image:: images/elasticsearch_configuration.png
  20. :scale: 90%
  21. +----------------+
  22. | |store_config| |
  23. +----------------+
  24. Available data store configuration parameters are summarized in the following table:
  25. .. list-table::
  26. :widths: 20 80
  27. * - Parameter
  28. - Description
  29. * - elasticsearch_host
  30. - Host (IP) for connecting to Elasticsearch. HTTP scheme and port can optionally be included to override the defaults. Multiple hosts can be provided. Examples::
  31. localhost
  32. localhost:9200
  33. http://localhost
  34. http://localhost:9200
  35. https://localhost:9200
  36. https://somehost.somedomain:9200,https://anotherhost.somedomain:9200
  37. * - elasticsearch_port
  38. - Default HTTP port for connecting to Elasticsearch. Ignored if the hostname includes the port.
  39. * - user
  40. - Elasticsearch user. Must have superuser privilege on index.
  41. * - passwd
  42. - Elasticsearch user password
  43. * - runas_geoserver_user
  44. - Whether to submit requests on behalf of the authenticated GeoServer user
  45. * - proxy_user
  46. - Elasticsearch user for document queries. If not provided then admin user credentials are used for all requests.
  47. * - proxy_passwd
  48. - Elasticsearch proxy user password
  49. * - index_name
  50. - Index name or alias (wildcards supported)
  51. * - reject_unauthorized
  52. - Whether to validate the server certificate during the SSL handshake for https connections
  53. * - default_max_features
  54. - Default used when maxFeatures is unlimited
  55. * - source_filtering_enabled
  56. - Whether to enable filtering of the _source field
  57. * - scroll_enabled
  58. - Enable the Elasticsearch scan and scroll API
  59. * - scroll_size
  60. - Number of documents per shard when using the scroll API
  61. * - scroll_time
  62. - Search context timeout when using the scroll API
  63. * - array_encoding
  64. - Array encoding strategy. Allowed values are ``JSON`` (keep arrays) and ``CSV`` (keep first array element).
  65. * - grid_size
  66. - Hint for Geohash grid size (numRows*numCols)
  67. * - grid_threshold
  68. - Geohash grid aggregation precision will be the minimum necessary so that actual_grid_size/grid_size > grid_threshold
  69. * - response_buffer_limit
  70. - Maximum number of bytes to buffer in memory when reading responses from Elasticsearch
  71. Configuring authentication
  72. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  73. Basic authentication is supported through the ``user`` and ``passwd`` credential parameters. The provided user must have
  74. superuser privilege on the index to enable the mapping and alias requests performed during store initialization.
  75. Note that aliases must already be present on the Elasticsearch index. If you enter an alias which is not present, the
  76. plugin will not generate it for you. Optional ``proxy_user`` and ``proxy_passwd`` parameters can be used to specify an
  77. alternate user for document search (OGC service) requests. The proxy user can have restricted privileges on the index
  78. through document level security. If not provided the default user is used for all requests.
  79. The ``runas_geoserver_user`` flag can be used to enable Elasticsearch requests to be submitted on behalf of the
  80. authenticated GeoServer user. When the run-as mechanism is configured the plugin will add the ``es-security-runas-user``
  81. header with the authenticated GeoServer username. See `X-Pack run-as documentation
  82. <https://www.elastic.co/guide/en/x-pack/current/run-as-privilege.html>`_ for more information. Note the run-as mechanism
  83. is applied only to document search requests.
  84. For added security it is recommended to define ``proxy_user`` and ``proxy_passwd`` when using the run-as mechanism. The
  85. proxy user will be used when submitting requests on behalf of the GeoServer user and can have restricted privileges
  86. enabling access only to documents that all users can have access to. The plugin can optionally be deployed to
  87. require user credentials and proxy credentials and to force the use of ``runas_geoserver_user`` by setting the
  88. environment variable ``org.geoserver.elasticsearch.xpack.force-runas``::
  89. $ export JAVA_OPTS="-Dorg.geoserver.elasticsearch.xpack.force-runas $JAVA_OPTS"
  90. Configuring HTTPS/SSL
  91. ~~~~~~~~~~~~~~~~~~~~~
  92. System properties are supported for SSL/TLS configuration::
  93. javax.net.ssl.trustStore
  94. javax.net.ssl.trustStorePassword
  95. javax.net.ssl.keyStore
  96. javax.net.ssl.keyStorePassword
  97. See `HttpClientBuilder <https://hc.apache.org/httpcomponents-userClient-ga/httpclient/apidocs/org/apache/http/impl/userClient/HttpClientBuilder.html>`_ documentation for available properties.
  98. For example, use ``javax.net.ssl.trustStore[Password]`` to validate server certificate::
  99. $ export JAVA_OPTS="-Djavax.net.ssl.trustStore=/path/to/truststore.jks -Djavax.net.ssl.trustStorePassword=changeme $JAVA_OPTS "
  100. Configuring layer
  101. ^^^^^^^^^^^^^^^^^
  102. The initial layer configuration panel for an Elasticsearch layer will include an additional pop-up showing a table of available fields.
  103. .. |field_list| image:: images/elasticsearch_fieldlist.png
  104. :scale: 100%
  105. :align: middle
  106. +--------------+
  107. | |field_list| |
  108. +--------------+
  109. .. list-table::
  110. :widths: 20 80
  111. * - Item
  112. - Description
  113. * - ``Use All``
  114. - Use all fields in the layer feature type
  115. * - ``Use``
  116. - Used to select the fields that will make up the layer feature type
  117. * - ``Name``
  118. - Name of the field
  119. * - ``Type``
  120. - Type of the field, as derived from the Elasticsearch schema. For geometry types, you have the option to provide a more specific data type.
  121. * - ``Order``
  122. - Integer order values are used to sort fields, where fields with smaller order are returned first
  123. * - ``Custom Name``
  124. - Provides the option to give the field a custom name
  125. * - ``Default Geometry``
  126. - Indicates if the geometry field is the default one. Useful if the documents contain more than one geometry field, as SLDs and spatial filters will hit the default geometry field unless otherwise specified
  127. * - ``Stored``
  128. - Indicates whether the field is stored in the index
  129. * - ``Analyzed``
  130. - Indicates whether the field is analyzed
  131. * - ``SRID``
  132. - Native spatial reference ID of the geometries. Currently only EPSG:4326 is supported.
  133. * - ``Valid Date Formats``
  134. - Possible valid date formats used for parsing field values and printing filter elements
  135. * - ``Refresh``
  136. - If the field mappings or Elasticsearch schema has changed since this page was loaded, use this button to update the field configuration list.
  137. To return to the field table after it has been closed, click the "Configure Elasticsearch fields" button below the "Feature Type Details" panel on the layer configuration page.
  138. .. |field_list_edit| image:: images/elasticsearch_fieldlist_edit.png
  139. :scale: 100%
  140. :align: middle
  141. +-------------------+
  142. | |field_list_edit| |
  143. +-------------------+
  144. Configuring logging
  145. ^^^^^^^^^^^^^^^^^^^
  146. Logging is configurable through Log4j. The data store includes logging such as the query object being sent to Elasticsearch, which is logged at a lower level than may be enabled by default. To enable these logs, add the following lines to the GeoServer logging configuration file (see GeoServer Global Settings)::
  147. log4j.category.org.geoserver.data.elasticsearch=DEBUG
  148. log4j.category.org.geoserver.process.elasticsearch=DEBUG
  149. The logging configuration file will be in the ``logs`` subdirectory in the GeoServer data directory. Check GeoServer global settings for which logging profile is being used (e.g. ``DEFAULT_LOGGING``, etc.).
  150. .. |logging| image:: images/elasticsearch_logging.png
  151. :scale: 100%
  152. :align: middle
  153. +-----------+
  154. | |logging| |
  155. +-----------+
  156. Filtering
  157. ---------
  158. Filtering capabilities include OpenGIS simple comparisons, temporal comparisons, as well as other common filter comparisons. Elasticsearch natively supports numerous spatial filter operators, depending on the type:
  159. - ``geo_shape`` types natively support BBOX/Intersects, Within and Disjoint binary spatial operators
  160. - ``geo_point`` types natively support BBOX and Within binary spatial operators, as well as the DWithin and Beyond distance buffer operators
  161. Requests involving spatial filter operators not natively supported by Elasticsearch will include an additional filtering operation on the results returned from the query, which may impact performance.
  162. Native queries
  163. ^^^^^^^^^^^^^^
  164. Native Elasticsearch queries can be applied in WMS feature requests through a custom rendering transformation, ``vec:GeoHashGrid``, which translates aggregation response data into a raster for display. If supplied, the query is combined with the query derived from the request bbox, CQL or OGC filter using the AND logical binary operator.
  165. Examples
  166. ^^^^^^^^
  167. BBOX and CQL filter::
  168. http://localhost:8080/geoserver/test/wms?service=WMS&version=1.1.0&request=GetMap
  169. &layers=test:active&styles=&bbox=-1,-1,10,10&width=279&height=512
  170. &srs=EPSG:4326&format=application/openlayers&maxFeatures=1000
  171. &cql_filter=standard_ss='IEEE 802.11b'
  172. BBOX and native query::
  173. http://localhost:8080/geoserver/test/wms?service=WMS&version=1.1.0&request=GetMap
  174. &layers=test:active&styles=NativeQueryStyle&bbox=-1,-1,10,10&width=279&height=512
  175. &srs=EPSG:4326&format=application/openlayers&maxFeatures=1000
  176. <StyledLayerDescriptor version="1.0.0"
  177. xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
  178. xmlns="http://www.opengis.net/sld"
  179. xmlns:ogc="http://www.opengis.net/ogc"
  180. xmlns:xlink="http://www.w3.org/1999/xlink"
  181. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  182. <NamedLayer>
  183. <Name>test</Name>
  184. <UserStyle>
  185. <Title>Test</Title>
  186. <Abstract>Test Native Query</Abstract>
  187. <FeatureTypeStyle>
  188. <Transformation>
  189. <ogc:Function name="vec:GeoHashGrid">
  190. <ogc:Function name="parameter">
  191. <ogc:Literal>data</ogc:Literal>
  192. </ogc:Function>
  193. <ogc:Function name="parameter">
  194. <ogc:Literal>queryDefinition</ogc:Literal>
  195. <ogc:Literal>{"term":{"standard_ss":"IEEE 802.11b"}}
  196. </ogc:Function>
  197. <ogc:Function name="parameter">
  198. <ogc:Literal>outputBBOX</ogc:Literal>
  199. <ogc:Function name="env">
  200. <ogc:Literal>wms_bbox</ogc:Literal>
  201. </ogc:Function>
  202. </ogc:Function>
  203. <ogc:Function name="parameter">
  204. <ogc:Literal>outputWidth</ogc:Literal>
  205. <ogc:Function name="env">
  206. <ogc:Literal>wms_width</ogc:Literal>
  207. </ogc:Function>
  208. </ogc:Function>
  209. <ogc:Function name="parameter">
  210. <ogc:Literal>outputHeight</ogc:Literal>
  211. <ogc:Function name="env">
  212. <ogc:Literal>wms_height</ogc:Literal>
  213. </ogc:Function>
  214. </ogc:Function>
  215. </ogc:Function>
  216. </Transformation>
  217. <Rule>
  218. <RasterSymbolizer>
  219. <Geometry>
  220. <!-- Actual geometry property name in feature source -->
  221. <ogc:PropertyName>geo</ogc:PropertyName></Geometry>
  222. <Opacity>0.6</Opacity>
  223. <ColorMap type="ramp" >
  224. <ColorMapEntry color="#FFFFFF" quantity="0" label="nodata" opacity="0"/>
  225. <ColorMapEntry color="#2851CC" quantity="1" label="values"/>
  226. <ColorMapEntry color="#211F1F" quantity="2" label="label"/>
  227. <ColorMapEntry color="#EE0F0F" quantity="3" label="label"/>
  228. <ColorMapEntry color="#AAAAAA" quantity="4" label="label"/>
  229. <ColorMapEntry color="#6FEE4F" quantity="5" label="label"/>
  230. <ColorMapEntry color="#DDB02C" quantity="10" label="label"/>
  231. </ColorMap>
  232. </RasterSymbolizer>
  233. </Rule>
  234. </FeatureTypeStyle>
  235. </UserStyle>
  236. </NamedLayer>
  237. </StyledLayerDescriptor>
  238. Aggregations
  239. ------------
  240. Elasticsearch aggregations are supported through WMS requests by including the query in WMS requests through a custom rendering transformation, ``vec:GeoHashGrid``, which translates aggregation response data into a raster for display.
  241. Note that size is set to zero when an aggregation is supplied so only aggregation features are returned (e.g. maxFeatures is ignored and there will be no search hit results). See FAQ_ for common issues using aggregations.
  242. Geohash grid aggregations
  243. ^^^^^^^^^^^^^^^^^^^^^^^^^
  244. Geohash grid aggregation support includes dynamic precision updating and a custom rendering transformation for visualization. Geohash grid aggregation precision is updated dynamically to approximate the specified ``grid_size`` based on current bbox extent and the additional ``grid_threshold`` parameter as described above.
  245. Geohash grid aggregation visualization is supported in WMS requests through a custom rendering transformation, ``vec:GeoHashGrid``, which translates aggregation response data into a raster for display. By default, raster values correspond to the aggregation bucket ``doc_count``. The following shows an example GeoServer style that uses the GeoHashGrid rendering transformation::
  246. <StyledLayerDescriptor version="1.0.0"
  247. xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
  248. xmlns="http://www.opengis.net/sld"
  249. xmlns:ogc="http://www.opengis.net/ogc"
  250. xmlns:xlink="http://www.w3.org/1999/xlink"
  251. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  252. <NamedLayer>
  253. <Name>GeoHashGrid</Name>
  254. <UserStyle>
  255. <Title>GeoHashGrid</Title>
  256. <Abstract>GeoHashGrid aggregation</Abstract>
  257. <FeatureTypeStyle>
  258. <Transformation>
  259. <ogc:Function name="vec:GeoHashGrid">
  260. <ogc:Function name="parameter">
  261. <ogc:Literal>data</ogc:Literal>
  262. </ogc:Function>
  263. <ogc:Function name="parameter">
  264. <ogc:Literal>gridStrategy</ogc:Literal>
  265. <ogc:Literal>Basic</ogc:Literal>
  266. </ogc:Function>
  267. <ogc:Function name="parameter">
  268. <ogc:Literal>outputBBOX</ogc:Literal>
  269. <ogc:Function name="env">
  270. <ogc:Literal>wms_bbox</ogc:Literal>
  271. </ogc:Function>
  272. </ogc:Function>
  273. <ogc:Function name="parameter">
  274. <ogc:Literal>outputWidth</ogc:Literal>
  275. <ogc:Function name="env">
  276. <ogc:Literal>wms_width</ogc:Literal>
  277. </ogc:Function>
  278. </ogc:Function>
  279. <ogc:Function name="parameter">
  280. <ogc:Literal>outputHeight</ogc:Literal>
  281. <ogc:Function name="env">
  282. <ogc:Literal>wms_height</ogc:Literal>
  283. </ogc:Function>
  284. </ogc:Function>
  285. </ogc:Function>
  286. </Transformation>
  287. <Rule>
  288. <RasterSymbolizer>
  289. <Geometry>
  290. <!-- Actual geometry property name in feature source -->
  291. <ogc:PropertyName>geo</ogc:PropertyName></Geometry>
  292. <Opacity>0.6</Opacity>
  293. <ColorMap type="ramp" >
  294. <ColorMapEntry color="#FFFFFF" quantity="0" label="nodata" opacity="0"/>
  295. <ColorMapEntry color="#2851CC" quantity="1" label="values"/>
  296. <ColorMapEntry color="#211F1F" quantity="2" label="label"/>
  297. <ColorMapEntry color="#EE0F0F" quantity="3" label="label"/>
  298. <ColorMapEntry color="#AAAAAA" quantity="4" label="label"/>
  299. <ColorMapEntry color="#6FEE4F" quantity="5" label="label"/>
  300. <ColorMapEntry color="#DDB02C" quantity="10" label="label"/>
  301. </ColorMap>
  302. </RasterSymbolizer>
  303. </Rule>
  304. </FeatureTypeStyle>
  305. </UserStyle>
  306. </NamedLayer>
  307. </StyledLayerDescriptor>
  308. Example WMS request including Geohash grid aggregation with the above custom style::
  309. http://localhost:8080/geoserver/test/wms?service=WMS&version=1.1.0&request=GetMap
  310. &layers=test:active&styles=geohashgrid&bbox=0.0,0.0,24.0,44.0&srs=EPSG:4326
  311. &width=418&height=768&format=application/openlayers
  312. The Elasticsearch aggregation definition can be computed automatically, or provided as an explicit parameter,
  313. for example::
  314. <ogc:Function name="parameter">
  315. <ogc:Literal>aggregationDefinition</ogc:Literal>
  316. <ogc:Literal>{"agg": {"geohash_grid": {"field": "_ogr_geometry_.coordinates", "precision": 3}}}</ogc:Literal>
  317. </ogc:Function>
  318. The store may update the precision to a smaller value, if it finds it goes beyond the aggregation
  319. limits setup in its configuration, see ``grid_size`` and ``grid_threshold`` above.
  320. Grid Strategy
  321. ^^^^^^^^^^^^^
  322. ``gridStrategy``: Parameter to identify the ``org.geoserver.process.elasticsearch.GeoHashGrid`` implementation that will be used to convert each geohashgrid bucket into a raster value (number).
  323. .. list-table::
  324. :widths: 20 20 20 40
  325. * - Name
  326. - gridStrategy
  327. - gridStrategyArgs
  328. - Description
  329. * - Basic
  330. - ``basic``
  331. - no
  332. - Raster value is geohashgrid bucket ``doc_count``.
  333. * - Metric
  334. - ``metric``
  335. - yes
  336. - Raster value is geohashgrid bucket metric value.
  337. * - Nested
  338. - ``nested_agg``
  339. - yes
  340. - Extract raster value from nested aggregation results.
  341. ``gridStrategyArgs``: (Optional) Parameter used to specify an optional argument list for the grid strategy.
  342. ``emptyCellValue``: (Optional) Parameter used to specify the value for empty grid cells. By default, empty grid cells are set to ``0``.
  343. ``scaleMin``, ``scaleMax``: (Optional) Parameters used to specify a scale applied to all raster values. Each tile request is scaled according to the min and max values for that tile. It is best to use a non-tiled layer with this parameter to avoid confusing results.
  344. ``useLog``: (Optional) Flag indicating whether to apply logarithm to raster values (applied prior to scaling, if applicable)
  345. Basic
  346. ~~~~~
  347. Raster value is geohashgrid bucket ``doc_count``.
  348. Example Aggregation::
  349. {
  350. "agg": {
  351. "geohash_grid": {
  352. "field": "geo"
  353. }
  354. }
  355. }
  356. Example bucket::
  357. {
  358. "key" : "xv",
  359. "doc_count" : 1
  360. }
  361. Extracted raster value: ``1``
  362. Metric
  363. ~~~~~~
  364. Raster value is geohashgrid bucket metric value.
  365. .. list-table::
  366. :widths: 20 20 60
  367. * - Argument Index
  368. - Default Value
  369. - Description
  370. * - 0
  371. - ``metric``
  372. - Key used to pluck metric object from top level bucket. Empty string results in plucking doc_count.
  373. * - 1
  374. - ``value``
  375. - Key used to pluck the value from the metric object.
  376. Example Aggregation::
  377. {
  378. "agg": {
  379. "geohash_grid": {
  380. "field": "geo"
  381. },
  382. "aggs": {
  383. "metric": {
  384. "max": {
  385. "field": "magnitude"
  386. }
  387. }
  388. }
  389. }
  390. }
  391. Example bucket::
  392. {
  393. "key" : "xv",
  394. "doc_count" : 1,
  395. "metric" : {
  396. "value" : 4.9
  397. }
  398. }
  399. Extracted raster value: ``4.9``
  400. Nested
  401. ~~~~~~~~~~
  402. Extract raster value from nested aggregation results.
  403. .. list-table::
  404. :widths: 20 20 60
  405. * - Argument Index
  406. - Default Value
  407. - Description
  408. * - 0
  409. - ``nested``
  410. - Key used to pluck nested aggregation results from the geogrid bucket.
  411. * - 1
  412. - empty string
  413. - Key used to pluck metric object from each nested aggregation bucket. Empty string results in plucking doc_count.
  414. * - 2
  415. - ``value``
  416. - Key used to pluck the value from the metric object.
  417. * - 3
  418. - ``largest``
  419. - ``largest`` | ``smallest``. Strategy used to select a bucket from the nested aggregation buckets. The grid cell raster value is extracted from the selected bucket.
  420. * - 4
  421. - ``value``
  422. - ``key`` | ``value``. Strategy used to extract the raster value from the selected bucket. ``value``: Raster value is the selected bucket's metric value. ``key``: Raster value is the selected bucket's key.
  423. * - 5
  424. - null
  425. - (Optional) Map used to convert String keys into numeric values. Use the format ``key1:1;key2:2``. Only utilized when raster strategy is ``key``.
  426. Example Aggregation::
  427. {
  428. "agg": {
  429. "geohash_grid": {
  430. "field": "geo"
  431. },
  432. "aggs": {
  433. "nested": {
  434. "histogram": {
  435. "field": "magnitude",
  436. "interval": 1,
  437. "min_doc_count": 1
  438. }
  439. }
  440. }
  441. }
  442. }
  443. Example Parameters::
  444. <ogc:Function name="parameter">
  445. <ogc:Literal>gridStrategyArgs</ogc:Literal>
  446. <ogc:Literal>nested</ogc:Literal>
  447. <ogc:Literal></ogc:Literal>
  448. <ogc:Literal></ogc:Literal>
  449. <ogc:Literal>largest</ogc:Literal>
  450. <ogc:Literal>key</ogc:Literal>
  451. </ogc:Function>
  452. Example bucket::
  453. {
  454. "key" : "xv",
  455. "doc_count" : 1729,
  456. "nested" : {
  457. "buckets" : [
  458. {
  459. "key" : 2.0,
  460. "doc_count" : 5
  461. },
  462. {
  463. "key" : 3.0,
  464. "doc_count" : 107
  465. },
  466. {
  467. "key" : 4.0,
  468. "doc_count" : 1506
  469. },
  470. {
  471. "key" : 5.0,
  472. "doc_count" : 100
  473. },
  474. {
  475. "key" : 6.0,
  476. "doc_count" : 11
  477. }
  478. ]
  479. }
  480. }
  481. Extracted raster value: ``4.0``
  482. Implementing a custom Grid Strategy
  483. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  484. By default the raster values computed in the geohash grid aggregation rendering transformation correspond to the top level ``doc_count``. Adding an additional strategy for computing the raster values from bucket data currently requires source code updates to the ``gt-elasticsearch-process`` module as described below.
  485. First create a custom implementation of ``org.geoserver.process.elasticsearch.GeoHashGrid`` and provide an implementation of the ``computeCellValue`` method, which takes the raw bucket data and returns the raster value. For example, the default basic implementation simply returns the doc_count::
  486. public class BasicGeoHashGrid extends GeoHashGrid {
  487. @Override
  488. public Number computeCellValue(Map<String,Object> bucket) {
  489. return (Number) bucket.get("doc_count");
  490. }
  491. }
  492. Then update ``org.geoserver.process.elasticsearch.GeoHashGridProcess`` and add a new entry to the Strategy enum to point to the custom implementation.
  493. After deploying the customized plugin, the new geohash grid computer can be used by updating the ``gridStrategy`` parameter in the GeoServer style::
  494. <StyledLayerDescriptor version="1.0.0"
  495. ...
  496. <Transformation>
  497. <ogc:Function name="vec:GeoHashGrid">
  498. ...
  499. <ogc:Function name="parameter">
  500. <ogc:Literal>gridStrategy</ogc:Literal>
  501. <ogc:Literal>NewName</ogc:Literal>
  502. </ogc:Function>
  503. .. _FAQ:
  504. FAQ
  505. ---
  506. - By default, arrays are returned directly, which is suitable for many output formats including GeoJSON. When using CSV output format with layers containing arrays it's necessary to set the ``array_encoding`` store parameter to ``CSV``. Note however when using the ``CSV`` array encoding that only the first value will be returned.
  507. - When updating from pre-2.11.0 versions of the plugin it may be necessary to reload older layers to enable full aggregation and time support. Missing aggregation data or errors of the form ``IllegalArgumentException: Illegal pattern component`` indicate a layer reload is necessary. In this case the layer must be removed and re-added to GeoServer (e.g. a feature type reload will not be sufficient).
  508. - Commas in the native query and aggregation body must be escaped with a backslash. Additionally, body may need to be URL encoded.
  509. - Geometry property name in the aggregation SLD RasterSymbolizer must be a valid geometry property in the layer
  510. - ``PropertyIsEqualTo`` maps to an Elasticsearch term query, which will return documents that contain the supplied term. When searching on an analyzed string field, ensure that the search values are consistent with the analyzer used in the index. For example, values may need to be lowercase when querying fields analyzed with the default analyzer. See the Elasticsearch term query documentation for more information.
  511. - ``PropertyIsLike`` maps to either a query string query or a regexp query, depending on whether the field is analyzed or not. Reserved characters should be escaped as applicable. Note case sensitive and insensitive searches may not be supported for analyzed and not analyzed fields, respectively. See Elasticsearch query string and regexp query documentation for more information.
  512. - Date conversions are handled using the valid date formats from the associated type mapping, or ``date_optional_time`` if not found. Note that UTC timezone is used for both parsing and printing of dates.
  513. - Filtering on Elasticsearch ``object`` types is supported. By default, field names will include the full path to the field (e.g. "parent.child.field_name"), but this can be changed in the GeoServer layer configuration.
  514. - When referencing fields with path elements using ``cql_filter``, it may be necessary to quote the name (e.g. ``cql_filter="parent.child.field_name"='value'``)
  515. - Filtering on Elasticsearch ``nested`` types is supported only for non-geospatial fields.
  516. - Circle geometries are approximate and may not be fully consistent with the implementation in Elasticsearch, especially at extreme latitudes (see `#86 <https://github.com/ngageoint/elasticgeo/issues/86>`_).
  517. - The ``joda-shaded`` module may need to be excluded when importing the project into Eclipse. Otherwise modules may have build errors of the form ``DateTimeFormatter cannot be resolved to a type``.
  518. - When updating from Elasticgeo 2.16.0, note that the ``Short Names`` feature has been removed as it is not compatible with Elasticsearch 2.0 and beyond. Previous fields which used the short names will be reverted to the full name, but you can still use aliasing to accomplish the same effect.