ngageoint / elasticgeo

ElasticGeo provides a GeoTools data store that allows geospatial features from an Elasticsearch index to be published via OGC services using GeoServer.
GNU General Public License v3.0
168 stars 85 forks source link

enable multi/cross index store setup via wildcard #3

Closed giaconiamark closed 8 years ago

giaconiamark commented 9 years ago

A lot of people create multiple indices of the same objects to partition the data nicely over time or space. For instance, if I index twitter all the time, but my majority use case is only to query the last three hours... I can create an index for each day or week or something, and only query a subset of the data most of the time instead of hitting a massive uber index. Currently, in Elastic, we can use the * at the end of a prefix, and this will enable query and aggregations across any indices beginning with the prefix. This would be great to be able to apply to ElasticGeo store setup.

sjudeng commented 9 years ago

Just merged in commit that might help with this. It includes a new store configuration parameter, search_indices. The original parameter, index_name, defines the specific index used to read the type, and the new parameter, search_indices, is used for reading features.

giaconiamark commented 9 years ago

nice... I'll give it a try thanks!

giaconiamark commented 9 years ago

I was able to build and deploy to GeoServer, and i input my search indexes no problem to create a store. I also created a layer and published it, but i cannot preview via GeoServer's "preview layer" tool in Openlayers. Not sure if it matters, but my index is of mixed geometry types (geo_shape)

sjudeng commented 9 years ago

Was it working before? Any error messages in the logs?

sjudeng commented 9 years ago

Are you able to see data when you click GML on the Layer Preview page? If so, try copying the OpenLayers link into another tab and then add "&maxFeatures=1000" to the end.

giaconiamark commented 9 years ago

this is what I got...

error:java.lang.RuntimeException: java.io.IOException: Error executing query search java.lang.RuntimeException: java.io.IOException: Error executing query search java.io.IOException: Error executing query search Error executing query search
giaconiamark commented 9 years ago

that was for the GML output

sjudeng commented 9 years ago

I just pushed an update that adds more logging around the search. To get this in your logs, you'll have to increase the logging level to FINE. If using Tomcat, edit TOMCAT_ROOT/conf/logging.properties and add the below line.

mil.nga.giat.level=FINE

Then try hitting GML again. This should show you the request being executed (see example below) and the error stack trace.

May 01, 2015 4:35:28 PM mil.nga.giat.data.elasticsearch.ElasticFeatureSource prepareSearchRequest
FINE: {
  "from" : 0,
  "size" : 50,
  "query" : {
    "match_all" : { }
  },
  "post_filter" : {
    "match_all" : { }
  },
  "_source" : {
    "includes" : [ "_id", "_index", "_type", "_score", "_relative_score", "status_s", "id", "security_ss", "standard_ss", "speed_is", "geo3", "modem_b", "installed_tdt", "vendor_s" ],
    "excludes" : [ ]
  },
  "sort" : [ {
    "_uid" : {
      "order" : "asc"
    }
  } ]
}
giaconiamark commented 9 years ago

I'll try to get back to this next week, so far so good. But as I look at the code, and the fact that I have mixed geometry types, I am tinkering with the idea of being able to register an actual query as a datasource definition, rather than an index or index alias. Kind of like a "view" in a traditional database.