[ 
https://issues.apache.org/jira/browse/UNOMI-585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kevan Jahanshahi updated UNOMI-585:
-----------------------------------
    Description: 
We cannot use flattened indexation on profile interests due to the queries 
requirement like range queries to be able to get profiles having interests < or 
> to a certain value.

So the last option we have to avoid mapping explosion is to index them as 
nested object like this:
{code:java}
"interests": [{
  "key": "cars",
  "value": 15
}, {
  "key": "football",
  "value": 45
}] {code}
For that we also need new ConditionType in Unomi, something that look like the 
BooleanConditionType:

{*}NestedConditionType{*}: would be perfect

Parameters: 
 * {*}path{*}: the path of the nested property
 * {*}condition{*}: the nested query to be applied on the nested property

So we could build up condition like this:
{code:java}
{
  "type": "nestedCondition",
  "parameterValues": {
    "path": "properties.interests",
    "subCondition": {
      "type": "booleanCondition",
      "parameterValues":{
        "operator": "and",
        "subConditions": [{
          "type": "propertyCondition",
          "parameterValues": {
            "propertyName": "properties.interests.key",
            "propertyValueInteger": "cars",
            "comparisonOperator": "equals"
          }
        },{
          "type": "propertyCondition",
          "parameterValues": {
            "propertyName": "properties.interests.value",
            "propertyValueInteger": 15,
            "comparisonOperator": "greaterThan"
          }
        }]
      }
    }
  }
} {code}
Also the this would required two new java classes dedicated for that purpose:

*NestedConditionESQueryBuilder* and {*}NestedConditionEvaluator{*}.

  was:
To avoid mapping explosion in ElasticSearch we should use flattened indexation 
on the property: interests for the profiles.

This way the gathered profile interests could scale a lot more safer.

(There will be limitation on the query possible on this property once it will 
be flattened, but it's a know and acceptable limitation.)


> Use nested mapping for profile.properties.interests
> ---------------------------------------------------
>
>                 Key: UNOMI-585
>                 URL: https://issues.apache.org/jira/browse/UNOMI-585
>             Project: Apache Unomi
>          Issue Type: New Feature
>    Affects Versions: 2.0.0
>            Reporter: Kevan Jahanshahi
>            Priority: Major
>             Fix For: 2.0.0
>
>
> We cannot use flattened indexation on profile interests due to the queries 
> requirement like range queries to be able to get profiles having interests < 
> or > to a certain value.
> So the last option we have to avoid mapping explosion is to index them as 
> nested object like this:
> {code:java}
> "interests": [{
>   "key": "cars",
>   "value": 15
> }, {
>   "key": "football",
>   "value": 45
> }] {code}
> For that we also need new ConditionType in Unomi, something that look like 
> the BooleanConditionType:
> {*}NestedConditionType{*}: would be perfect
> Parameters: 
>  * {*}path{*}: the path of the nested property
>  * {*}condition{*}: the nested query to be applied on the nested property
> So we could build up condition like this:
> {code:java}
> {
>   "type": "nestedCondition",
>   "parameterValues": {
>     "path": "properties.interests",
>     "subCondition": {
>       "type": "booleanCondition",
>       "parameterValues":{
>         "operator": "and",
>         "subConditions": [{
>           "type": "propertyCondition",
>           "parameterValues": {
>             "propertyName": "properties.interests.key",
>             "propertyValueInteger": "cars",
>             "comparisonOperator": "equals"
>           }
>         },{
>           "type": "propertyCondition",
>           "parameterValues": {
>             "propertyName": "properties.interests.value",
>             "propertyValueInteger": 15,
>             "comparisonOperator": "greaterThan"
>           }
>         }]
>       }
>     }
>   }
> } {code}
> Also the this would required two new java classes dedicated for that purpose:
> *NestedConditionESQueryBuilder* and {*}NestedConditionEvaluator{*}.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to