Giter Site home page Giter Site logo

Comments (12)

sjudeng avatar sjudeng commented on June 15, 2024

Try adding the below lines to your logging file (see here)

log4j.category.mil.nga.giat.data.elasticsearch=DEBUG
log4j.category.mil.nga.giat.process.elasticsearch=DEBUG

This should show the queries that are being sent to Elasticsearch and you can then execute them manually to see if there's any obvious issue with the response. What version of the plugin are you using? Are all the fields nested?

from elasticgeo.

bytemedwb avatar bytemedwb commented on June 15, 2024

from elasticgeo.

sjudeng avatar sjudeng commented on June 15, 2024

It should. Filtering isn't supported on nested geometries (it's okay for the object type). But this looks like an issue with feature reading not filtering. Can you post your Elasticsearch mapping (or a snippet including the geo and a couple of the other fields)?

from elasticgeo.

bytemedwb avatar bytemedwb commented on June 15, 2024

from elasticgeo.

sjudeng avatar sjudeng commented on June 15, 2024

I have not been able to reproduce this yet. I took the mapping and sample document you provided and added them to ES 5.4.3.

curl -XPUT http://localhost:9200/coalesce-oeevent
curl -XPUT -H 'content-type: application/json' http://localhost:9200/coalesce-oeevent/_mapping/recordset -d @mapping.json
curl -XPOST -H 'content-type: application/json' http://localhost:9200/coalesce-oeevent/recordset -d @doc.json

I was then able to add the store and publish the layer in GeoServer. Fields in WFS (GML/GeoJSON) results were populated with expected non-null values.

curl "http://localhost:8080/geoserver/test/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=test:recordset&maxFeatures=50&outputFormat=json"
{
  "crs": {
    "type": "name", 
    "properties": {
      "name": "urn:ogc:def:crs:EPSG::4326"
    }
  }, 
  "totalFeatures": 1, 
  "type": "FeatureCollection", 
  "features": [
    {
      "geometry": {
        "type": "Point", 
        "coordinates": [
          -71.53140259, 
          42.23730087
        ]
      }, 
      "properties": {
        "coalesceentity.version": "0.2", 
        "eventrecordset.actiongeofeatureid": "MA", 
        "_score": 1, 
        "eventrecordset.ontologyreference.fields.keyword": "Event", 
        "eventrecordset.eventbasecode": "042", 
        "eventrecordset.dateadded": 0, 
        "eventrecordset.actiongeoadm2code.fields.keyword": "", 
        "eventrecordset.actiongeoadm1code.fields.keyword": "USMA", 
        "_aggregation": null, 
        "coalesceentity.source": "G2Core", 
        "eventrecordset.pmesiipttime": 0.25, 
        "eventrecordset.eventrootcode": "04", 
        "_relative_score": 1, 
        "coalesceentity.name": "OEEvent", 
        "eventrecordset.actiongeocountrycode.fields.keyword": "US", 
        "eventrecordset.pmesiiptmilitary": 0.25, 
        "eventrecordset.datasource.fields.keyword": "GDELT", 
        "eventrecordset.day": 20180311, 
        "eventrecordset.eventcode": "042", 
        "eventrecordset.pmesiiptinfrastructure": 0.25, 
        "eventrecordset.avgtone": -4.989154, 
        "eventrecordset.pmesiiptpolitical": 0.5, 
        "eventrecordset.actiongeofeatureid.fields.keyword": "MA", 
        "eventrecordset.numarticles": 10, 
        "eventrecordset.numsources": 1, 
        "eventrecordset.actiongeofullname.fields.keyword": "Massachusetts, United States", 
        "_type": "recordset", 
        "eventrecordset.issimulation": false, 
        "eventrecordset.nummentions": 10, 
        "eventrecordset.tags": null, 
        "eventrecordset.globaleventid": 737769639, 
        "eventrecordset.ontologyreference": "Event", 
        "eventrecordset.datasource": "GDELT", 
        "eventrecordset.actiongeofullname": "Massachusetts, United States", 
        "eventrecordset.monthyear": 201803, 
        "coalesceentity.objectkey": "2c639634-7fd3-47bb-893d-120feb492ac9", 
        "eventrecordset.eventrootcode.fields.keyword": "04", 
        "eventrecordset.sourceurl.fields.keyword": "http://nhpr.org/post/winter-storm-watch-tuesday-nhs-town-meeting-day", 
        "coalesceentity.lastmodified": "2018-03-11T15:11:33.996Z", 
        "eventrecordset.sourceurl": "http://nhpr.org/post/winter-storm-watch-tuesday-nhs-town-meeting-day", 
        "eventrecordset.actiongeotype": 2, 
        "eventrecordset.actiongeocountrycode": "US", 
        "eventrecordset.year": 2018, 
        "eventrecordset.quadclass": 1, 
        "eventrecordset.datetime": "2018-03-11T14:15:00Z", 
        "eventrecordset.pmesiiptinformation": 0.5, 
        "eventrecordset.actiongeoadm2code": "", 
        "eventrecordset.actiongeoadm1code": "USMA", 
        "eventrecordset.isrootevent": 0, 
        "eventrecordset.pmesiipteconomic": 0.25, 
        "_index": "coalesce-oeevent", 
        "eventrecordset.pmesiiptphysicalenvironment": 0.5, 
        "coalesceentity.datecreated": "2018-03-11T15:11:33.985Z", 
        "eventrecordset.goldsteinscale": 1.9, 
        "eventrecordset.eventcode.fields.keyword": "042", 
        "eventrecordset.eventbasecode.fields.keyword": "042", 
        "eventrecordset.pmesiiptsocial": 0.5, 
        "_id": "AWOfnRqCqTF0HjaY37Wm", 
        "eventrecordset.fractiondate": 2018.1945
      }, 
      "type": "Feature", 
      "id": "recordset.AWOfnRqCqTF0HjaY37Wm", 
      "geometry_name": "eventrecordset.actiongeolocation"
    }
  ]
}

Compute from bounds also worked as expected when adding the feature type. Note in practice with larger number of documents it's recommended to manually enter the layer bounds to avoid expensive computation, though it doesn't explain the issue with null values in your features.

from elasticgeo.

bytemedwb avatar bytemedwb commented on June 15, 2024

from elasticgeo.

dclemenzi avatar dclemenzi commented on June 15, 2024

Here are some additional details. Placing a break point on line 313 in ElasticParserUtil here is the content of the source mapping:

source = {LinkedHashMap@7557}  size = 10
 0 = {LinkedHashMap$Entry@7956} "test1.int" -> "10"
 1 = {LinkedHashMap$Entry@7957} "coalesceentity.name" -> "UNIT_TEST"
 2 = {LinkedHashMap$Entry@7958} "test1.geo" -> "-3.18, 51.4347"
 3 = {LinkedHashMap$Entry@7959} "coalesceentity.datecreated" -> "2018-06-07T14:47:57.343Z"
 4 = {LinkedHashMap$Entry@7960} "coalesceentity.source" -> "DSS"
 5 = {LinkedHashMap$Entry@7961} "test1.string" -> "EUROPE"
 6 = {LinkedHashMap$Entry@7962} "test1.date" -> "2018-06-07T14:47:57.374Z"
 7 = {LinkedHashMap$Entry@7963} "coalesceentity.lastmodified" -> "2018-06-07T14:47:57.375Z"
 8 = {LinkedHashMap$Entry@7964} "coalesceentity.version" -> "1.0"
 9 = {LinkedHashMap$Entry@7965} "coalesceentity.objectkey" -> "b4cbb5fa-7106-4b75-a2bc-791f88cc8373"

Line 310 splits the name being passed in so on line 313 its looking for the key coalesceentity instead of coalesceentity.name which results in a null value. If line 313 could pass in the name unmodified the code would work. I don't understand ElasticSearch well enough to know why its splitting the name in the first place. Any guidance would be appreciate.

I tried pulling the source and modifing it but that resulted in a non-shaded jar. How was the 2.13.0 version compiled and deployed?

from elasticgeo.

dclemenzi avatar dclemenzi commented on June 15, 2024

Don't know if this is a bad approach or not but this code change resolves the issue:

    public List<Object> readField(Map<String, Object> source, String name) {
        final List<String> keys = Arrays.asList(name.split("\\."));
        List<Object> values = new ArrayList<>();
        if (!keys.isEmpty()) {
            readField(source.get(keys.get(0)), keys.subList(1, keys.size()), values);
        }
        final List<Object> result;
        if (!values.isEmpty()) {
            result = values;
        } else {
            result = null;
        }
        return result;
    }

To:

public List<Object> readField(Map<String, Object> source, String name) {
        final List<String> keys = Arrays.asList(name.split("\\."));
        List<Object> values = new ArrayList<>();
        if (!keys.isEmpty()) {

            Object entry = source.get(keys.get(0));

            if (entry == null)
            {
                entry = source.get(name);
            }

            readField(entry, keys.subList(1, keys.size()), values);
        }
        final List<Object> result;
        if (!values.isEmpty()) {
            result = values;
        } else {
            result = null;
        }
        return result;
    }

from elasticgeo.

sjudeng avatar sjudeng commented on June 15, 2024

The change looks reasonable, can you add a test and open a PR with the update? Looks like you figured it out but when building locally you'll find the shaded jar in gs-web-elasticsearch/target/elasticgeo-2.13-SNAPSHOT.jar.

from elasticgeo.

dclemenzi avatar dclemenzi commented on June 15, 2024

Getting a 403 when attempting to push to a branch. Not sure what I am missing.

from elasticgeo.

sjudeng avatar sjudeng commented on June 15, 2024

Pushing to your fork or this repo? You'd only be able to push to your fork and then you can open a PR from there. If you haven't already click Fork above and then in your local folder do a git remote add dclemenzi https://github.com/dclemenzi/elasticgeo.git. Then you should be able to do a git push dclemenzi your-branch.

from elasticgeo.

sjudeng avatar sjudeng commented on June 15, 2024

Fixed by #71 (thanks @dclemenzi)

from elasticgeo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.