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

Kevan Jahanshahi reassigned UNOMI-709:
--------------------------------------

    Assignee: Kevan Jahanshahi

> Profile property type warn and error after migrating to unomi 2.0.0
> -------------------------------------------------------------------
>
>                 Key: UNOMI-709
>                 URL: https://issues.apache.org/jira/browse/UNOMI-709
>             Project: Apache Unomi
>          Issue Type: Bug
>    Affects Versions: unomi-2.0.0
>            Reporter: Kevan Jahanshahi
>            Assignee: Kevan Jahanshahi
>            Priority: Major
>             Fix For: unomi-2.2.0
>
>
> in ticket: UNOMI-321 there is a strange implement and attempt to provide 
> automatic profile properties ES mapping depending on the Unomi profile 
> property type.
> Guilty commit: 
> [https://github.com/apache/unomi/commit/b558f079f89a9126e22da75312ceb0c11a428f54#]
> After migrating from 1.6.x to 2.0.0 we observe warnings and errors due to 
> this automatic mapping feature.
> The feature have been added to the profileService endpoint: 
> in ProfileServiceImpl:
>  
> {code:java}
> @Override
> public boolean setPropertyType(PropertyType property) {
>     PropertyType previousProperty = 
> persistenceService.load(property.getItemId(), PropertyType.class);
>     boolean result = false;
>     if (previousProperty == null) {
>         result = persistenceService.save(property);
>         propertyTypes = propertyTypes.with(property);
>     } else if (merge(previousProperty, property)) {
>         result = persistenceService.save(previousProperty);
>         propertyTypes = propertyTypes.with(previousProperty);
>     }
>     persistenceService.setPropertyMapping(property, Profile.ITEM_TYPE);
>     return result;
> } {code}
> ProfileServiceEndPoint:
>  
> {code:java}
> /**
>  * Persists the specified property type in the context server.
>  *
>  * TODO: move to a different class
>  *
>  * @param property the property type to persist
>  * @return {@code true} if the property type was properly created, {@code 
> false} otherwise (for example, if the property type already existed
>  */
> @POST
> @Path("/properties")
> public boolean setPropertyType(PropertyType property) {
>     return profileService.setPropertyType(property);
> } {code}
> Here is the warning we can observe: 
> {code:java}
> 16:52:31.632 WARN [qtp1514291829-299] No predefined type found for 
> property[email], no mapping will be created {code}
> In case of property type is using email type.
> Here is the Error we can face:
> {code:java}
> 16:52:32.772 ERROR [qtp1514291829-299] Internal server error Elasticsearch 
> exception [type=illegal_argument_exception, reason=mapper [properties.income] 
> cannot be changed from type [long] to [integer]]: 
> ElasticsearchStatusException[Elasticsearch exception 
> [type=illegal_argument_exception, reason=mapper [properties.income] cannot be 
> changed from type [long] to [integer]]] in 
> org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
>  (Set RuntimeExceptionMapper in debug to get the full stacktrace) {code}
> Because the property *income* was mapped as long in unomi 1.6.0 but try to be 
> remapped as integer in unomi 2.0.0
> This feature should try to remap existing mapped props, and also we could add 
> support for email property type (ES mapping to text at least or email if ES 
> have type for that)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to