Comments (3)
It appears that you associated your "exact"
matcher with your "license.number"
field, which is a full-text value, but your "exact"
matcher expects a keyword value, which would be "license.number.keyword"
.
Here's where you can apply that change:
{
...
"indices": {
"my_index": {
"fields": {
...
"license.number.keyword": {
"attribute": "licenseNumber",
"matcher": "exact"
}
}
}
}
}
Additionally, because "license.number.keyword"
is part of a nested object, your matcher for that field needs to use the "nested"
query syntax. This only affects your "license"
resolver. If you intend to submit resolution requests based on "license"
, you should use the following matcher and index field configuration:
Here's where you can apply that change:
{
...
"matchers": {
...
"exact_license_nested": {
"clause": {
"nested": {
"path": "license",
"query": {
"term": {
"{{ field }}": "{{ value }}"
}
}
}
}
},
...
}
"indices": {
"my_index": {
"fields": {
...
"license.number.keyword": {
"attribute": "licenseNumber",
"matcher": "exact_license_nested"
}
}
}
}
}
Here is the entire updated entity model:
{
"attributes": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"licenseNumber": {
"type": "string"
}
},
"resolvers": {
"name": {
"attributes": ["lastName", "firstName"]
},
"license": {
"attributes": ["licenseNumber"]
}
},
"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"
}
}
}
}
}
The following resolution requests will now return your example document:
POST _zentity/resolution/my_index
{
"attributes": {
"lastName": ["Doe"],
"firstName": ["John"]
},
"scope": {
"include": {
"indices": ["my_index"],
"resolvers": ["name"]
}
}
}
POST _zentity/resolution/my_index
{
"attributes": {
"licenseNumber": ["123"]
},
"scope": {
"include": {
"indices": ["my_index"],
"resolvers": ["license"]
}
}
}
As you continue to add fields to your nested "license"
object, you can reuse the "exact_license_nested"
matcher to perform exact matching on any of those fields. If you want to perform other kinds of matching on those fields, you'll need to create another matcher that uses the nested query syntax.
from zentity.
Thank you @davemoore- it worked perfectly.
from zentity.
Hello @prabhushan can you share with me insight about zentity performance in your use case ? Please
from zentity.
Related Issues (20)
- [Bug] HOT 2
- Support for ElasticSearch 8.X HOT 12
- support recent patch versions for ES 7.17.x HOT 1
- Non-Lating Language Support
- Zentity not honoring nesting HOT 6
- Release Plan: 1.6.2 HOT 1
- Add logging to zentity
- Use a multi-node cluster in production mode for integration tests HOT 3
- Rename the default branch from "master" to "main" HOT 1
- Allow creation of entity models with empty top-level objects. HOT 2
- Implement and enforce requirements for names of attributes, resolvers, and matchers. HOT 2
- Allow attributes to be represented as nested fields HOT 1
- Release Plan 1.8.0 HOT 2
- Add integration tests for Elasticsearch security features HOT 2
- [Bug] zentity fails to obtain attribute values from object arrays during resolution
- Release Plan: 1.8.1 HOT 1
- OpenSearch support HOT 1
- Releases 7.12.1.jar instead of .zip HOT 1
- Support for Elasticsearch 7.13.x and 7.14.x HOT 1
- Support OpenSearch HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zentity.