zentity-io / zentity

Entity resolution for Elasticsearch.
https://zentity.io
Apache License 2.0
157 stars 28 forks source link

Unable to detect nested object attribute from the resolver results #49

Closed kokqing closed 3 years ago

kokqing commented 4 years ago

Hi, I had created my zentity model which include some nested object of array attributes to be resolved. However when I run the resolution, the _attributes list that was return from the result only include those attribute that was declared at the root level of the document.

Those nested object attributes were not being detected thus those nested object array attributes could not be used for subsequent recursive resolving traversal.

Is there anyway to do this? Thanks

E.g { "attributes": { "firstName": { "type": "string" }, "lastName": { "type": "string" }, "licenseNumber": { "type": "string" } }, "resolvers": { "name": { "attributes": ["lastName", "firstName"] }, "license": { "attributes": ["licenseNumber","firstName"] } }, "matchers": { "exact": { "clause": { "term": { "{{ field }}": "{{ value }}" } } }, "exact_license_nested": { "clause": { "nested": { "path": "license", "query": { "term": { "{{ field }}": "{{ value }}" } } } } }, "fuzzy": { "clause": { "match": { "{{ field }}": { "query": "{{ value }}", "fuzziness": "auto", "operator": "AND" } } } } }, "indices": { "my_index": { "fields": { "firstName": { "attribute": "firstName", "matcher": "fuzzy" }, "lastName": { "attribute": "lastName", "matcher": "fuzzy" }, "license.number.keyword": { "attribute": "licenseNumber", "matcher": "exact_license_nested" } } } } } When I run the resolution, the result _attributes portion will only consist of firstName, lastName but not licenseNumber although license.number is inside the document in the form of

license:[{number:1},{number:2}]. Having this will only result in traversing the "name" resolver but not the "license" resolver for subsequent hops.

davemoore- commented 3 years ago

@kokqing Thanks for pointing this out. I'm able to reproduce the issue, and I'll work toward a resolution in an upcoming patch release.

davemoore- commented 3 years ago

Closing issue and tracking progress on #85