You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by dr...@apache.org on 2016/12/19 14:23:08 UTC

incubator-unomi git commit: UNOMI-70 : updated mappings, fixed aggregation and queries

Repository: incubator-unomi
Updated Branches:
  refs/heads/feature-UNOMI-70-ES5X ca5c99011 -> e6ec7a042


UNOMI-70 : updated mappings, fixed aggregation and queries


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/e6ec7a04
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/e6ec7a04
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/e6ec7a04

Branch: refs/heads/feature-UNOMI-70-ES5X
Commit: e6ec7a0425748a4fe7c0b4a05b63dfede2cc12c4
Parents: ca5c990
Author: Thomas Draier <dr...@apache.org>
Authored: Mon Dec 19 10:58:31 2016 +0100
Committer: Thomas Draier <dr...@apache.org>
Committed: Mon Dec 19 15:10:14 2016 +0100

----------------------------------------------------------------------
 .../META-INF/cxs/mappings/userList.json         |  22 +-
 .../ElasticSearchPersistenceServiceImpl.java    |  20 +-
 .../META-INF/cxs/mappings/actionType.json       |  16 -
 .../META-INF/cxs/mappings/campaign.json         |  28 +-
 .../META-INF/cxs/mappings/campaignevent.json    |  25 +-
 .../META-INF/cxs/mappings/conditionType.json    |  76 -----
 .../resources/META-INF/cxs/mappings/event.json  | 312 +------------------
 .../resources/META-INF/cxs/mappings/goal.json   |  22 +-
 .../META-INF/cxs/mappings/persona.json          |  32 --
 .../META-INF/cxs/mappings/personaSession.json   |  56 ----
 .../META-INF/cxs/mappings/profile.json          |  27 +-
 .../META-INF/cxs/mappings/propertyType.json     |  24 +-
 .../resources/META-INF/cxs/mappings/rule.json   |  19 --
 .../META-INF/cxs/mappings/scoring.json          |  22 +-
 .../META-INF/cxs/mappings/segment.json          |  22 +-
 .../META-INF/cxs/mappings/session.json          |  24 +-
 .../PropertyConditionESQueryBuilder.java        |   4 +-
 .../conditions/PropertyConditionEvaluator.java  |  12 +-
 .../services/services/GoalsServiceImpl.java     |   2 +-
 .../services/services/QueryServiceImpl.java     |   2 +-
 20 files changed, 47 insertions(+), 720 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/extensions/lists-extension/services/src/main/resources/META-INF/cxs/mappings/userList.json
----------------------------------------------------------------------
diff --git a/extensions/lists-extension/services/src/main/resources/META-INF/cxs/mappings/userList.json b/extensions/lists-extension/services/src/main/resources/META-INF/cxs/mappings/userList.json
index 244d71a..53fd043 100644
--- a/extensions/lists-extension/services/src/main/resources/META-INF/cxs/mappings/userList.json
+++ b/extensions/lists-extension/services/src/main/resources/META-INF/cxs/mappings/userList.json
@@ -1,17 +1,5 @@
 {
   "userList": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer" : "folding"
-          }
-        }
-      }
-    ],
     "properties": {
       "itemId": {
         "type": "keyword"
@@ -21,10 +9,6 @@
       },
       "metadata": {
         "properties": {
-          "description": {
-            "type": "text",
-            "analyzer": "folding"
-          },
           "enabled": {
             "type": "boolean"
           },
@@ -37,14 +21,14 @@
           "missingPlugins": {
             "type": "boolean"
           },
-          "name": {
-            "type": "keyword"
-          },
           "readOnly": {
             "type": "boolean"
           },
           "scope": {
             "type": "keyword"
+          },
+          "tags": {
+            "type": "keyword"
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
index 020d1d4..f1912bd 100644
--- a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
+++ b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
@@ -1135,12 +1135,12 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
 
     @Override
     public <T extends Item> List<T> query(final String fieldName, final String[] fieldValues, String sortBy, final Class<T> clazz) {
-        return query(QueryBuilders.termsQuery(fieldName, ConditionContextHelper.foldToASCII(fieldValues)), sortBy, clazz, 0, -1, getRouting(fieldName, fieldValues, clazz), null).getList();
+        return query(QueryBuilders.termsQuery(fieldName, fieldValues), sortBy, clazz, 0, -1, getRouting(fieldName, fieldValues, clazz), null).getList();
     }
 
     @Override
     public <T extends Item> PartialList<T> query(String fieldName, String fieldValue, String sortBy, Class<T> clazz, int offset, int size) {
-        return query(QueryBuilders.termQuery(fieldName, ConditionContextHelper.foldToASCII(fieldValue)), sortBy, clazz, offset, size, getRouting(fieldName, new String[]{fieldValue}, clazz), null);
+        return query(QueryBuilders.termQuery(fieldName, fieldValue), sortBy, clazz, offset, size, getRouting(fieldName, new String[]{fieldValue}, clazz), null);
     }
 
     @Override
@@ -1243,12 +1243,16 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
                                     requestBuilder = requestBuilder.addSort(distanceSortBuilder.order(SortOrder.ASC));
                                 }
                             } else {
+                                String name = StringUtils.substringBeforeLast(sortByElement,":");
+                                if (name.equals("metadata.name") || name.equals("metadata.description")
+                                        || name.equals("properties.firstName") || name.equals("properties.lastName")
+                                        ) {
+                                    name += ".keyword";
+                                }
                                 if (sortByElement.endsWith(":desc")) {
-                                    requestBuilder = requestBuilder.addSort(sortByElement.substring(0, sortByElement.length() - ":desc".length()), SortOrder.DESC);
-                                } else if (sortByElement.endsWith(":asc")) {
-                                    requestBuilder = requestBuilder.addSort(sortByElement.substring(0, sortByElement.length() - ":asc".length()), SortOrder.ASC);
+                                    requestBuilder = requestBuilder.addSort(name, SortOrder.DESC);
                                 } else {
-                                    requestBuilder = requestBuilder.addSort(sortByElement, SortOrder.ASC);
+                                    requestBuilder = requestBuilder.addSort(name, SortOrder.ASC);
                                 }
                             }
                         }
@@ -1384,7 +1388,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
                         }
                         for (DateRange range : dateRangeAggregate.getDateRanges()) {
                             if (range != null) {
-                                rangebuilder.addRange(range.getKey(), range.getFrom().toString(), range.getTo().toString());
+                                rangebuilder.addRange(range.getKey(), range.getFrom() != null ? range.getFrom().toString() : null, range.getTo() != null ? range.getTo().toString() : null);
                             }
                         }
                         bucketsAggregation = rangebuilder;
@@ -1636,7 +1640,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService,
         new InClassLoaderExecute<Void>() {
             @Override
             protected Void execute(Object... args) {
-                QueryBuilder query = QueryBuilders.termQuery("scope", ConditionContextHelper.foldToASCII(scope));
+                QueryBuilder query = QueryBuilders.termQuery("scope", scope);
 
                 BulkRequestBuilder deleteByScope = client.prepareBulk();
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/actionType.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/actionType.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/actionType.json
deleted file mode 100644
index fa2f0ea..0000000
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/actionType.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-  "actionType": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ]
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/campaign.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/campaign.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/campaign.json
index efdcb3c..acd4b85 100644
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/campaign.json
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/campaign.json
@@ -1,17 +1,5 @@
 {
   "campaign": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
     "properties": {
       "cost": {
         "type": "double"
@@ -20,12 +8,10 @@
         "type": "keyword"
       },
       "startDate": {
-        "type": "date",
-        "format": "strict_date_optional_time||epoch_millis"
+        "type": "date"
       },
       "endDate": {
-        "type": "date",
-        "format": "strict_date_optional_time||epoch_millis"
+        "type": "date"
       },
       "itemId": {
         "type": "keyword"
@@ -41,10 +27,6 @@
       },
       "metadata": {
         "properties": {
-          "description": {
-            "type": "text",
-            "analyzer": "folding"
-          },
           "enabled": {
             "type": "boolean"
           },
@@ -57,9 +39,6 @@
           "missingPlugins": {
             "type": "boolean"
           },
-          "name": {
-            "type": "keyword"
-          },
           "readOnly": {
             "type": "boolean"
           },
@@ -67,8 +46,7 @@
             "type": "keyword"
           },
           "tags": {
-            "type": "text",
-            "analyzer": "folding"
+            "type": "keyword"
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/campaignevent.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/campaignevent.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/campaignevent.json
index f682e6a..7308995 100644
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/campaignevent.json
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/campaignevent.json
@@ -1,17 +1,5 @@
 {
   "campaignevent": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
     "properties": {
       "campaignId": {
         "type": "keyword"
@@ -23,8 +11,7 @@
         "type": "keyword"
       },
       "eventDate": {
-        "type": "date",
-        "format": "strict_date_optional_time||epoch_millis"
+        "type": "date"
       },
       "itemId": {
         "type": "keyword"
@@ -37,10 +24,6 @@
       },
       "metadata": {
         "properties": {
-          "description": {
-            "type": "text",
-            "analyzer": "folding"
-          },
           "enabled": {
             "type": "boolean"
           },
@@ -53,14 +36,14 @@
           "missingPlugins": {
             "type": "boolean"
           },
-          "name": {
-            "type": "keyword"
-          },
           "readOnly": {
             "type": "boolean"
           },
           "scope": {
             "type": "keyword"
+          },
+          "tags": {
+            "type": "keyword"
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/conditionType.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/conditionType.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/conditionType.json
deleted file mode 100644
index 702a9f1..0000000
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/conditionType.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
-  "conditionType": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
-    "properties" : {
-      "conditionEvaluator" : {
-        "type" : "keyword"
-      },
-      "itemId" : {
-        "type" : "keyword"
-      },
-      "itemType" : {
-        "type" : "keyword"
-      },
-      "metadata" : {
-        "properties" : {
-          "description" : {
-            "type" : "text",
-            "analyzer" : "folding"
-          },
-          "enabled" : {
-            "type" : "boolean"
-          },
-          "hidden" : {
-            "type" : "boolean"
-          },
-          "id" : {
-            "type" : "keyword"
-          },
-          "missingPlugins" : {
-            "type" : "boolean"
-          },
-          "name" : {
-            "type" : "keyword"
-          },
-          "readOnly" : {
-            "type" : "boolean"
-          },
-          "tags" : {
-            "type" : "text",
-            "analyzer" : "folding"
-          }
-        }
-      },
-      "parameters" : {
-        "properties" : {
-          "defaultValue" : {
-            "type" : "keyword"
-          },
-          "id" : {
-            "type" : "keyword"
-          },
-          "multivalued" : {
-            "type" : "boolean"
-          },
-          "type" : {
-            "type" : "keyword"
-          }
-        }
-      },
-      "queryBuilder" : {
-        "type" : "keyword"
-      }
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json
index 939120d..c240b3b 100644
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json
@@ -1,17 +1,5 @@
 {
   "event": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
     "properties": {
       "eventType": {
         "type": "keyword"
@@ -25,17 +13,6 @@
       "profileId": {
         "type": "keyword"
       },
-      "properties": {
-        "properties": {
-          "src_terms[0]": {
-            "properties": {
-              "term": {
-                "type": "keyword"
-              }
-            }
-          }
-        }
-      },
       "scope": {
         "type": "keyword"
       },
@@ -43,296 +20,9 @@
         "type": "keyword"
       },
       "timeStamp": {
-        "type": "date",
-        "format": "strict_date_optional_time||epoch_millis"
-      },
-      "source": {
-        "properties": {
-          "eventType": {
-            "type": "keyword"
-          },
-          "itemId": {
-            "type": "keyword"
-          },
-          "itemType": {
-            "type": "keyword"
-          },
-          "profileId": {
-            "type": "keyword"
-          },
-          "properties": {
-            "properties": {
-              "pageInfo": {
-                "properties": {
-                  "destinationURL": {
-                    "type": "keyword"
-                  },
-                  "language": {
-                    "type": "keyword"
-                  },
-                  "pageName": {
-                    "type": "keyword"
-                  },
-                  "pagePath": {
-                    "type": "keyword"
-                  },
-                  "referringURL": {
-                    "type": "keyword"
-                  },
-                  "variant": {
-                    "type": "keyword"
-                  }
-                }
-              }
-            }
-          },
-          "scope": {
-            "type": "keyword"
-          },
-          "sessionId": {
-            "type": "keyword"
-          },
-          "source": {
-            "properties": {
-              "itemId": {
-                "type": "keyword"
-              },
-              "itemType": {
-                "type": "keyword"
-              },
-              "scope": {
-                "type": "keyword"
-              }
-            }
-          },
-          "target": {
-            "properties": {
-              "itemId": {
-                "type": "keyword"
-              },
-              "itemType": {
-                "type": "keyword"
-              },
-              "properties": {
-                "properties": {
-                  "pageInfo": {
-                    "properties": {
-                      "destinationURL": {
-                        "type": "keyword"
-                      },
-                      "language": {
-                        "type": "keyword"
-                      },
-                      "pageName": {
-                        "type": "keyword"
-                      },
-                      "pagePath": {
-                        "type": "keyword"
-                      },
-                      "referringURL": {
-                        "type": "keyword"
-                      },
-                      "variant": {
-                        "type": "keyword"
-                      }
-                    }
-                  }
-                }
-              },
-              "scope": {
-                "type": "keyword"
-              }
-            }
-          },
-          "timeStamp": {
-            "type": "date"
-          }
-        }
-      },
-      "target": {
-        "properties": {
-          "campaignId": {
-            "type": "keyword"
-          },
-          "duration": {
-            "type": "long"
-          },
-          "itemId": {
-            "type": "keyword"
-          },
-          "itemType": {
-            "type": "keyword"
-          },
-          "metadata": {
-            "properties": {
-              "enabled": {
-                "type": "boolean"
-              },
-              "hidden": {
-                "type": "boolean"
-              },
-              "id": {
-                "type": "keyword"
-              },
-              "missingPlugins": {
-                "type": "boolean"
-              },
-              "name": {
-                "type": "keyword"
-              },
-              "readOnly": {
-                "type": "boolean"
-              },
-              "scope": {
-                "type": "keyword"
-              },
-              "tags": {
-                "type": "text",
-                "analyzer": "folding",
-                "fields": {
-                  "keyword": {
-                    "type": "keyword",
-                    "ignore_above": 256
-                  }
-                }
-              }
-            }
-          },
-          "profile": {
-            "properties": {
-              "itemId": {
-                "type": "keyword"
-              },
-              "itemType": {
-                "type": "keyword"
-              },
-              "properties": {
-                "properties": {
-                  "firstVisit": {
-                    "type": "date"
-                  }
-                }
-              }
-            }
-          },
-          "profileId": {
-            "type": "keyword"
-          },
-          "properties": {
-            "properties": {
-              "birthDate": {
-                "type": "date"
-              },
-              "email": {
-                "type": "keyword"
-              },
-              "faceBookId": {
-                "type": "keyword"
-              },
-              "firstName": {
-                "type": "keyword"
-              },
-              "gender": {
-                "type": "keyword"
-              },
-              "goalId": {
-                "type": "keyword"
-              },
-              "lastName": {
-                "type": "keyword"
-              },
-              "leadAssignedTo": {
-                "type": "keyword"
-              },
-              "nationality": {
-                "type": "keyword"
-              },
-              "origin": {
-                "type": "keyword"
-              },
-              "pageInfo": {
-                "properties": {
-                  "destinationURL": {
-                    "type": "keyword"
-                  },
-                  "language": {
-                    "type": "keyword"
-                  },
-                  "pageName": {
-                    "type": "keyword"
-                  },
-                  "pagePath": {
-                    "type": "keyword"
-                  },
-                  "referringURL": {
-                    "type": "keyword"
-                  },
-                  "variant": {
-                    "type": "keyword"
-                  }
-                }
-              },
-              "path": {
-                "type": "keyword"
-              },
-              "phoneNumber": {
-                "type": "keyword"
-              },
-              "randomNumber": {
-                "type": "long"
-              },
-              "twitterId": {
-                "type": "keyword"
-              },
-              "variantId": {
-                "type": "keyword"
-              },
-              "workspace": {
-                "type": "keyword"
-              }
-            }
-          },
-          "scope": {
-            "type": "keyword"
-          },
-          "size": {
-            "type": "long"
-          },
-          "startEvent": {
-            "properties": {
-              "parameterValues": {
-                "properties": {
-                  "pagePath": {
-                    "type": "keyword"
-                  }
-                }
-              },
-              "type": {
-                "type": "keyword"
-              }
-            }
-          },
-          "targetEvent": {
-            "properties": {
-              "parameterValues": {
-                "properties": {
-                  "pagePath": {
-                    "type": "keyword"
-                  }
-                }
-              },
-              "type": {
-                "type": "keyword"
-              }
-            }
-          },
-          "timeStamp": {
-            "type": "date"
-          }
-        }
+        "type": "date"
       }
     }
   }
 }
 
-

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/goal.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/goal.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/goal.json
index 7290220..081915b 100644
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/goal.json
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/goal.json
@@ -1,17 +1,5 @@
 {
   "goal": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
     "properties": {
       "campaignId": {
         "type": "keyword"
@@ -24,10 +12,6 @@
       },
       "metadata": {
         "properties": {
-          "description": {
-            "type": "text",
-            "analyzer" : "folding"
-          },
           "enabled": {
             "type": "boolean"
           },
@@ -40,9 +24,6 @@
           "missingPlugins": {
             "type": "boolean"
           },
-          "name": {
-            "type": "keyword"
-          },
           "readOnly": {
             "type": "boolean"
           },
@@ -50,8 +31,7 @@
             "type": "keyword"
           },
           "tags": {
-            "type": "text",
-            "analyzer": "folding"
+            "type": "keyword"
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/persona.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/persona.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/persona.json
deleted file mode 100644
index db9828b..0000000
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/persona.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
-  "persona": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
-    "properties" : {
-      "properties" : {
-        "properties": {
-          "description": {
-            "type": "text",
-            "analyzer": "folding"
-          },
-          "firstName": {
-            "type": "keyword"
-          },
-          "lastName": {
-            "type": "keyword"
-          }
-        }
-      }
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/personaSession.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/personaSession.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/personaSession.json
index c54a860..cb26f1e 100644
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/personaSession.json
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/personaSession.json
@@ -1,17 +1,5 @@
 {
   "personaSession": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
     "properties": {
       "duration" : {
         "type" : "long"
@@ -35,20 +23,6 @@
           },
           "itemType" : {
             "type" : "keyword"
-          },
-          "properties" : {
-            "properties" : {
-              "description" : {
-                "type" : "text",
-                "analyzer" : "folding"
-              },
-              "firstName" : {
-                "type" : "keyword"
-              },
-              "lastName" : {
-                "type" : "keyword"
-              }
-            }
           }
         }
       },
@@ -57,38 +31,8 @@
       },
       "properties" : {
         "properties" : {
-          "deviceCategory" : {
-            "type" : "keyword"
-          },
           "location" : {
             "type" : "geo_point"
-          },
-          "operatingSystemFamily" : {
-            "type" : "keyword"
-          },
-          "operatingSystemName" : {
-            "type" : "keyword"
-          },
-          "remoteAddr" : {
-            "type" : "keyword"
-          },
-          "remoteHost" : {
-            "type" : "keyword"
-          },
-          "sessionCity" : {
-            "type" : "keyword"
-          },
-          "sessionCountryCode" : {
-            "type" : "keyword"
-          },
-          "sessionCountryName" : {
-            "type" : "keyword"
-          },
-          "userAgentName" : {
-            "type" : "keyword"
-          },
-          "userAgentVersion" : {
-            "type" : "keyword"
           }
         }
       },

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/profile.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/profile.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/profile.json
index 9aba5d0..665941d 100644
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/profile.json
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/profile.json
@@ -1,17 +1,5 @@
 {
   "profile": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
     "properties": {
       "itemId": {
         "type": "keyword"
@@ -21,23 +9,14 @@
       },
       "properties": {
         "properties": {
-          "j:nodename": {
-            "type": "keyword"
-          },
-          "preferredLanguage": {
-            "type": "keyword"
-          },
           "firstVisit": {
-            "type": "date",
-            "format": "strict_date_optional_time||epoch_millis"
+            "type": "date"
           },
           "lastVisit": {
-            "type": "date",
-            "format": "strict_date_optional_time||epoch_millis"
+            "type": "date"
           },
           "previousVisit": {
-            "type": "date",
-            "format": "strict_date_optional_time||epoch_millis"
+            "type": "date"
           },
           "nbOfVisits": {
             "type": "long"

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/propertyType.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/propertyType.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/propertyType.json
index c03111c..bdba719 100644
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/propertyType.json
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/propertyType.json
@@ -1,17 +1,5 @@
 {
   "propertyType": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
     "properties": {
       "automaticMappingsFrom": {
         "type": "keyword"
@@ -55,11 +43,14 @@
           "missingPlugins": {
             "type": "boolean"
           },
-          "name": {
-            "type": "keyword"
-          },
           "readOnly": {
             "type": "boolean"
+          },
+          "scope": {
+            "type": "keyword"
+          },
+          "tags": {
+            "type": "keyword"
           }
         }
       },
@@ -86,8 +77,7 @@
         "type": "double"
       },
       "tags": {
-        "type": "text",
-        "analyzer": "folding"
+        "type": "keyword"
       },
       "target": {
         "type": "keyword"

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/rule.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/rule.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/rule.json
index 842181a..aad6029 100644
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/rule.json
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/rule.json
@@ -1,17 +1,5 @@
 {
   "rule": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
     "properties": {
       "itemId": {
         "type": "keyword"
@@ -21,10 +9,6 @@
       },
       "metadata": {
         "properties": {
-          "description": {
-            "type": "text",
-            "analyzer": "folding"
-          },
           "enabled": {
             "type": "boolean"
           },
@@ -37,9 +21,6 @@
           "missingPlugins": {
             "type": "boolean"
           },
-          "name": {
-            "type": "keyword"
-          },
           "readOnly": {
             "type": "boolean"
           },

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/scoring.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/scoring.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/scoring.json
index 70b2f8d..b46d7e2 100644
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/scoring.json
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/scoring.json
@@ -1,17 +1,5 @@
 {
   "scoring": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
     "properties": {
       "itemId": {
         "type": "keyword"
@@ -21,10 +9,6 @@
       },
       "metadata": {
         "properties": {
-          "description": {
-            "type": "text",
-            "analyzer": "folding"
-          },
           "enabled": {
             "type": "boolean"
           },
@@ -37,9 +21,6 @@
           "missingPlugins": {
             "type": "boolean"
           },
-          "name": {
-            "type": "keyword"
-          },
           "readOnly": {
             "type": "boolean"
           },
@@ -47,8 +28,7 @@
             "type": "keyword"
           },
           "tags": {
-            "type": "text",
-            "analyzer" : "folding"
+            "type": "keyword"
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/segment.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/segment.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/segment.json
index 2d25939..322ff19 100644
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/segment.json
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/segment.json
@@ -1,17 +1,5 @@
 {
   "segment": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
     "properties": {
       "itemId": {
         "type": "keyword"
@@ -21,10 +9,6 @@
       },
       "metadata": {
         "properties": {
-          "description": {
-            "type": "text",
-            "analyzer": "folding"
-          },
           "enabled": {
             "type": "boolean"
           },
@@ -37,14 +21,14 @@
           "missingPlugins": {
             "type": "boolean"
           },
-          "name": {
-            "type": "keyword"
-          },
           "readOnly": {
             "type": "boolean"
           },
           "scope": {
             "type": "keyword"
+          },
+          "tags": {
+            "type": "keyword"
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/session.json
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/session.json b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/session.json
index b0f6215..b1759a3 100644
--- a/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/session.json
+++ b/persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/session.json
@@ -1,17 +1,5 @@
 {
   "session": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "text",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding"
-          }
-        }
-      }
-    ],
     "properties": {
       "duration": {
         "type": "long"
@@ -23,8 +11,7 @@
         "type": "keyword"
       },
       "lastEventDate": {
-        "type": "date",
-        "format": "strict_date_optional_time||epoch_millis"
+        "type": "date"
       },
       "profileId": {
         "type": "keyword"
@@ -43,12 +30,6 @@
         "properties": {
           "location": {
             "type": "geo_point"
-          },
-          "pageReferringURL": {
-            "type": "keyword"
-          },
-          "referringURL": {
-            "type": "keyword"
           }
         }
       },
@@ -59,8 +40,7 @@
         "type": "long"
       },
       "timeStamp": {
-        "type": "date",
-        "format": "strict_date_optional_time||epoch_millis"
+        "type": "date"
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
index c36722b..31aa0a3 100644
--- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
+++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionESQueryBuilder.java
@@ -44,12 +44,12 @@ public class PropertyConditionESQueryBuilder implements ConditionESQueryBuilder
             throw new IllegalArgumentException("Impossible to build ES filter, condition is not valid, comparisonOperator and propertyName properties should be provided");
         }
 
-        String expectedValue = ConditionContextHelper.foldToASCII((String) condition.getParameter("propertyValue"));
+        String expectedValue = (String) condition.getParameter("propertyValue");
         Object expectedValueInteger = condition.getParameter("propertyValueInteger");
         Object expectedValueDate = condition.getParameter("propertyValueDate");
         Object expectedValueDateExpr = condition.getParameter("propertyValueDateExpr");
 
-        List<?> expectedValues = ConditionContextHelper.foldToASCII((List<?>) condition.getParameter("propertyValues"));
+        List<?> expectedValues = (List<?>) condition.getParameter("propertyValues");
         List<?> expectedValuesInteger = (List<?>) condition.getParameter("propertyValuesInteger");
         List<?> expectedValuesDate = (List<?>) condition.getParameter("propertyValuesDate");
         List<?> expectedValuesDateExpr = (List<?>) condition.getParameter("propertyValuesDateExpr");

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
----------------------------------------------------------------------
diff --git a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
index 68e58a6..d8b7754 100644
--- a/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
+++ b/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/PropertyConditionEvaluator.java
@@ -83,7 +83,7 @@ public class PropertyConditionEvaluator implements ConditionEvaluator {
             return false;
         }
         
-        List<Object> actual = ConditionContextHelper.foldToASCII(getValueSet(actualValue));
+        List<Object> actual = getValueSet(actualValue);
 
         boolean result = true;
         
@@ -136,7 +136,7 @@ public class PropertyConditionEvaluator implements ConditionEvaluator {
         String op = (String) condition.getParameter("comparisonOperator");
         String name = (String) condition.getParameter("propertyName");
 
-        String expectedValue = ConditionContextHelper.foldToASCII((String) condition.getParameter("propertyValue"));
+        String expectedValue = (String) condition.getParameter("propertyValue");
         Object expectedValueInteger = condition.getParameter("propertyValueInteger");
         Object expectedValueDate = condition.getParameter("propertyValueDate");
         Object expectedValueDateExpr = condition.getParameter("propertyValueDateExpr");
@@ -165,9 +165,6 @@ public class PropertyConditionEvaluator implements ConditionEvaluator {
                 actualValue = null;
             }
         }
-        if (actualValue instanceof String) {
-            actualValue = ConditionContextHelper.foldToASCII((String) actualValue);
-        }
 
         if(op == null) {
             return false;
@@ -178,9 +175,6 @@ public class PropertyConditionEvaluator implements ConditionEvaluator {
         } else if (op.equals("equals")) {
             if (actualValue instanceof Collection) {
                 for (Object o : ((Collection<?>)actualValue)) {
-                    if (o instanceof String) {
-                        o = ConditionContextHelper.foldToASCII((String) o);
-                    }
                     if (compare(o, expectedValue, expectedValueDate, expectedValueInteger, expectedValueDateExpr) == 0) {
                         return true;
                     }
@@ -220,7 +214,7 @@ public class PropertyConditionEvaluator implements ConditionEvaluator {
         } else if (op.equals("matchesRegex")) {
             return expectedValue != null && Pattern.compile(expectedValue).matcher(actualValue.toString()).matches();
         } else if (op.equals("in") || op.equals("notIn") || op.equals("hasSomeOf") || op.equals("hasNoneOf") || op.equals("all")) {
-            List<?> expectedValues = ConditionContextHelper.foldToASCII((List<?>) condition.getParameter("propertyValues"));
+            List<?> expectedValues = (List<?>) condition.getParameter("propertyValues");
             List<?> expectedValuesInteger = (List<?>) condition.getParameter("propertyValuesInteger");
             List<?> expectedValuesDate = (List<?>) condition.getParameter("propertyValuesDate");
             List<?> expectedValuesDateExpr = (List<?>) condition.getParameter("propertyValuesDateExpr");

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
index 65553fb..a99f155 100644
--- a/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/GoalsServiceImpl.java
@@ -492,7 +492,7 @@ public class GoalsServiceImpl implements GoalsService, SynchronousBundleListener
             }
 
             if(aggregate == null){
-                aggregate = new TermsAggregate(query.getAggregate().getProperty());
+                aggregate = new TermsAggregate(query.getAggregate().getProperty() + ".keyword");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e6ec7a04/services/src/main/java/org/apache/unomi/services/services/QueryServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/QueryServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/QueryServiceImpl.java
index 33e4f47..79edd43 100644
--- a/services/src/main/java/org/apache/unomi/services/services/QueryServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/QueryServiceImpl.java
@@ -83,7 +83,7 @@ public class QueryServiceImpl implements QueryService {
             }
 
             // fall back on terms aggregate
-            return persistenceService.aggregateQuery(query.getCondition(), new TermsAggregate(property), itemType);
+            return persistenceService.aggregateQuery(query.getCondition(), new TermsAggregate(property + ".keyword"), itemType);
         }
 
         return getAggregate(itemType, property);