This is an automated email from the ASF dual-hosted git repository. shuber pushed a commit to branch UNOMI-225-ES7 in repository https://gitbox.apache.org/repos/asf/unomi.git
commit 9315ab707b95bf7270cdf68ddcc32871165a5895 Author: Serge Huber <[email protected]> AuthorDate: Tue Nov 19 17:31:27 2019 +0100 UNOMI-225 ElasticSearch 7 support Model changes: - change geonames to use context prefix (will require re-import) - added mapping types for all types - Unomi should now start, but there are still known issues (integration tests do not run, actions are not properly register on first start). - index.name was changed to index.prefix Signed-off-by: Serge Huber <[email protected]> --- .../unomi/geonames/services/GeonameEntry.java | 1 - .../geonames/services/GeonamesServiceImpl.java | 6 +- .../META-INF/cxs/mappings/geonameEntry.json | 47 +++++++----- .../resources/META-INF/cxs/mappings/userList.json | 46 ++++++++---- .../main/resources/etc/custom.system.properties | 2 +- .../ElasticSearchPersistenceServiceImpl.java | 85 ++++++++++------------ .../cxs/mappings/{event.json => actiontype.json} | 10 +-- .../resources/META-INF/cxs/mappings/campaign.json | 48 ++++++------ .../META-INF/cxs/mappings/campaignevent.json | 40 +++++----- .../mappings/{event.json => conditiontype.json} | 10 +-- .../resources/META-INF/cxs/mappings/event.json | 8 +- .../cxs/mappings/{event.json => exportconfig.json} | 10 +-- .../main/resources/META-INF/cxs/mappings/goal.json | 29 ++++---- .../cxs/mappings/{event.json => importconfig.json} | 10 +-- .../cxs/mappings/{profile.json => persona.json} | 27 ++++--- .../META-INF/cxs/mappings/personaSession.json | 35 +++++---- .../resources/META-INF/cxs/mappings/profile.json | 27 ++++--- .../META-INF/cxs/mappings/propertyType.json | 72 +++++++++--------- .../main/resources/META-INF/cxs/mappings/rule.json | 46 ++++++------ .../cxs/mappings/{event.json => rulestats.json} | 10 +-- .../resources/META-INF/cxs/mappings/scoring.json | 31 ++++---- .../resources/META-INF/cxs/mappings/segment.json | 32 ++++---- .../resources/META-INF/cxs/mappings/session.json | 35 ++++----- .../resources/OSGI-INF/blueprint/blueprint.xml | 9 +-- .../org.apache.unomi.persistence.elasticsearch.cfg | 2 +- 25 files changed, 327 insertions(+), 351 deletions(-) diff --git a/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonameEntry.java b/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonameEntry.java index 36f4f0b..a2611bb 100644 --- a/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonameEntry.java +++ b/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonameEntry.java @@ -26,7 +26,6 @@ import java.util.Map; public class GeonameEntry extends Item { public static final String ITEM_TYPE = "geonameEntry"; - public static final String INDEX_NAME = "geonames"; private static final long serialVersionUID = 1L; protected String name; protected String asciiname; diff --git a/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonamesServiceImpl.java b/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonamesServiceImpl.java index 22ac964..430677e 100644 --- a/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonamesServiceImpl.java +++ b/extensions/geonames/services/src/main/java/org/apache/unomi/geonames/services/GeonamesServiceImpl.java @@ -80,10 +80,10 @@ public class GeonamesServiceImpl implements GeonamesService { } public void importDatabase() { - if (!persistenceService.createIndex("geonames")) { + if (!persistenceService.createIndex(GeonameEntry.ITEM_TYPE)) { if (forceDbImport) { - persistenceService.removeIndex("geonames"); - persistenceService.createIndex("geonames"); + persistenceService.removeIndex(GeonameEntry.ITEM_TYPE); + persistenceService.createIndex(GeonameEntry.ITEM_TYPE); logger.info("Geonames index removed and recreated"); } else if (persistenceService.getAllItemsCount(GeonameEntry.ITEM_TYPE) > 0) { return; diff --git a/extensions/geonames/services/src/main/resources/META-INF/cxs/mappings/geonameEntry.json b/extensions/geonames/services/src/main/resources/META-INF/cxs/mappings/geonameEntry.json index 64038ab..6950737 100644 --- a/extensions/geonames/services/src/main/resources/META-INF/cxs/mappings/geonameEntry.json +++ b/extensions/geonames/services/src/main/resources/META-INF/cxs/mappings/geonameEntry.json @@ -1,22 +1,35 @@ { - "geonameEntry": { - "properties": { - "elevation": { - "type": "long" - }, - - "location": { - "type": "geo_point" - }, - "modificationDate": { - "type": "date", - "format": "strict_date_optional_time||epoch_millis" - }, - - "population": { - "type": "long" + "dynamic_templates": [ + { + "all": { + "match": "*", + "match_mapping_type": "string", + "mapping": { + "type": "text", + "analyzer": "folding", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + } } - + } + ], + "properties": { + "elevation": { + "type": "long" + }, + "location": { + "type": "geo_point" + }, + "modificationDate": { + "type": "date", + "format": "strict_date_optional_time||epoch_millis" + }, + "population": { + "type": "long" } } } \ No newline at end of file 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 d73e8b3..3d3322b 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,22 +1,38 @@ { - "userList": { - "properties": { - "metadata": { - "properties": { - "enabled": { - "type": "boolean" - }, - "hidden": { - "type": "boolean" - }, - "missingPlugins": { - "type": "boolean" - }, - "readOnly": { - "type": "boolean" + "dynamic_templates": [ + { + "all": { + "match": "*", + "match_mapping_type": "string", + "mapping": { + "type": "text", + "analyzer": "folding", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } } } } } + ], + "properties": { + "metadata": { + "properties": { + "enabled": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "missingPlugins": { + "type": "boolean" + }, + "readOnly": { + "type": "boolean" + } + } + } } } \ No newline at end of file diff --git a/package/src/main/resources/etc/custom.system.properties b/package/src/main/resources/etc/custom.system.properties index dc14052..f964cb9 100644 --- a/package/src/main/resources/etc/custom.system.properties +++ b/package/src/main/resources/etc/custom.system.properties @@ -66,7 +66,7 @@ org.apache.unomi.elasticsearch.cluster.name=${env:UNOMI_ELASTICSEARCH_CLUSTERNAM # hostA:9200,hostB:9200 # Note: the port number must be repeated for each host. org.apache.unomi.elasticsearch.addresses=${env:UNOMI_ELASTICSEARCH_ADDRESSES:-localhost:9200} -org.apache.unomi.elasticsearch.index.name=${env:UNOMI_ELASTICSEARCH_INDEXNAME:-context} +org.apache.unomi.elasticsearch.index.prefix=${env:UNOMI_ELASTICSEARCH_INDEXPREFIX:-context} org.apache.unomi.elasticsearch.monthlyIndex.nbShards=${env:UNOMI_ELASTICSEARCH_MONTHLYINDEX_SHARDS:-5} org.apache.unomi.elasticsearch.monthlyIndex.nbReplicas=${env:UNOMI_ELASTICSEARCH_MONTHLYINDEX_REPLICAS:-0} org.apache.unomi.elasticsearch.defaultIndex.nbShards=${env:UNOMI_ELASTICSEARCH_DEFAULTINDEX_SHARDS:-5} 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 f1949ed..31b527d 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 @@ -122,7 +122,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, private String elasticSearchAddresses; private List<String> elasticSearchAddressList = new ArrayList<>(); private String clusterName; - private String indexName; + private String indexPrefix; private String monthlyIndexNumberOfShards; private String monthlyIndexNumberOfReplicas; private String numberOfShards; @@ -132,7 +132,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, private ConditionEvaluatorDispatcher conditionEvaluatorDispatcher; private ConditionESQueryBuilderDispatcher conditionESQueryBuilderDispatcher; - private Map<String, String> indexNames; + private Map<String, String> indexNames = new HashMap<>(); private List<String> itemsMonthlyIndexed; private Map<String, String> routingByType; @@ -174,8 +174,8 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, } } - public void setIndexName(String indexName) { - this.indexName = indexName; + public void setIndexPrefix(String indexPrefix) { + this.indexPrefix = indexPrefix; } public void setMonthlyIndexNumberOfShards(String monthlyIndexNumberOfShards) { @@ -288,9 +288,9 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, bulkProcessorBackoffPolicy = System.getProperty(BULK_PROCESSOR_BACKOFF_POLICY, bulkProcessorBackoffPolicy); // this property is used for integration tests, to make sure we don't conflict with an already running ElasticSearch instance. - if (System.getProperty("org.apache.unomi.itests.elasticsearch.transport.port") != null) { + if (System.getProperty("org.apache.unomi.itests.elasticsearch.http.port") != null) { elasticSearchAddressList.clear(); - elasticSearchAddressList.add("localhost:" + System.getProperty("org.apache.unomi.itests.elasticsearch.transport.port")); + elasticSearchAddressList.add("localhost:" + System.getProperty("org.apache.unomi.itests.elasticsearch.http.port")); logger.info("Overriding ElasticSearch address list from system property=" + elasticSearchAddressList); } // this property is used for integration tests, to make sure we don't conflict with an already running ElasticSearch instance. @@ -310,7 +310,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, nodeList.add(new Node(new HttpHost(elasticSearchHostName, elasticSearchPort, "http"))); } - logger.info("Connecting to ElasticSearch persistence backend using cluster name " + clusterName + " and index name " + indexName + "..."); + logger.info("Connecting to ElasticSearch persistence backend using cluster name " + clusterName + " and index name " + indexPrefix + "..."); client = new RestHighLevelClient( RestClient.builder(nodeList.toArray(new Node[nodeList.size()]))); @@ -334,28 +334,6 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, } } - // @todo is there a better way to detect index existence than to wait for it to startup ? - boolean indexExists = false; - int tries = 0; - - while (!indexExists && tries < 20) { - - indexExists = client.indices().exists(new GetIndexRequest(indexName), RequestOptions.DEFAULT); - tries++; - try { - Thread.sleep(100); - } catch (InterruptedException e) { - logger.error("Interrupted", e); - } - } - if (!indexExists) { - logger.info("{} index doesn't exist yet, creating it...", getIndex("profile", null)); - internalCreateIndex(getIndex("profile", null), mappings.get("profile")); - } else { - logger.info("Found index {}, ElasticSearch started successfully.", getIndex("profile", null)); - createMapping(getIndex("profile", null), mappings.get("profile")); - } - createMonthlyIndexTemplate(); if (client != null && bulkProcessor == null) { @@ -534,9 +512,23 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, } String mappingSource = content.toString(); mappings.put(name, mappingSource); - if (createMapping) { - createMapping(name, mappingSource); + boolean indexExists = false; + + String itemIndexName = getIndex(name, new Date()); + indexExists = client.indices().exists(new GetIndexRequest(itemIndexName), RequestOptions.DEFAULT); + if (!indexExists) { + logger.info("{} index doesn't exist yet, creating it...", itemIndexName); + internalCreateIndex(itemIndexName, mappingSource); + } else { + logger.info("Found index {}", itemIndexName); + if (createMapping) { + logger.info("Updating mapping for {}", itemIndexName); + createMapping(name, mappingSource); + } } + logger.info("Waiting for GREEN cluster status..."); + client.cluster().health(new ClusterHealthRequest().waitForGreenStatus(), RequestOptions.DEFAULT); + logger.info("Cluster status is GREEN"); } catch (Exception e) { logger.error("Error while loading mapping definition " + predefinedMappingURL, e); } @@ -633,9 +625,10 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, String itemType = item.getItemType(); String itemId = item.getItemId(); putInCache(itemId, item); - String index = getIndex(itemType, ((TimestampedItem) item).getTimeStamp() ); + String index = getIndex(itemType, itemsMonthlyIndexed.contains(itemType) ? ((TimestampedItem) item).getTimeStamp() : null); IndexRequest indexRequest = new IndexRequest(index); indexRequest.id(itemId); + indexRequest.source(source, XContentType.JSON); if (routingByType.containsKey(itemType)) { indexRequest.routing(routingByType.get(itemType)); } @@ -817,7 +810,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, BulkRequest deleteByScopeBulkRequest = new BulkRequest(); final TimeValue keepAlive = TimeValue.timeValueHours(1); - SearchRequest searchRequest = new SearchRequest(indexName + "*") + SearchRequest searchRequest = new SearchRequest(indexPrefix + "*") .indices(getIndexNameForQuery(itemType)) .scroll(keepAlive); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder() @@ -906,7 +899,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, Boolean result = new InClassLoaderExecute<Boolean>(metricsService, this.getClass().getName() + ".createMonthlyIndexTemplate") { protected Boolean execute(Object... args) throws IOException { PutIndexTemplateRequest putIndexTemplateRequest = new PutIndexTemplateRequest("context-event-monthly-indices") - .patterns(Arrays.asList(indexName + "-event-" + INDEX_DATE_PREFIX + "*")) + .patterns(Arrays.asList(indexPrefix + "-event-" + INDEX_DATE_PREFIX + "*")) .settings("{\n" + " \"index\" : {\n" + " \"number_of_shards\" : " + monthlyIndexNumberOfShards + ",\n" + @@ -937,10 +930,10 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, public boolean createIndex(final String indexName) { Boolean result = new InClassLoaderExecute<Boolean>(metricsService, this.getClass().getName() + ".createIndex") { protected Boolean execute(Object... args) throws IOException { - GetIndexRequest getIndexRequest = new GetIndexRequest(indexName); + GetIndexRequest getIndexRequest = new GetIndexRequest((indexPrefix + "-" + indexName).toLowerCase()); boolean indexExists = client.indices().exists(getIndexRequest, RequestOptions.DEFAULT); if (!indexExists) { - internalCreateIndex(indexName, mappings.get(indexName)); + internalCreateIndex((indexPrefix + "-" + indexName).toLowerCase(), mappings.get(indexName)); } return !indexExists; } @@ -955,10 +948,10 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, public boolean removeIndex(final String indexName) { Boolean result = new InClassLoaderExecute<Boolean>(metricsService, this.getClass().getName() + ".removeIndex") { protected Boolean execute(Object... args) throws IOException { - GetIndexRequest getIndexRequest = new GetIndexRequest(indexName); + GetIndexRequest getIndexRequest = new GetIndexRequest(indexPrefix + "-" + indexName); boolean indexExists = client.indices().exists(getIndexRequest, RequestOptions.DEFAULT); if (indexExists) { - DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(indexName); + DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(indexPrefix + "-" + indexName); client.indices().delete(deleteIndexRequest, RequestOptions.DEFAULT); } return indexExists; @@ -1005,9 +998,9 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, try { if (itemsMonthlyIndexed.contains(type)) { createMonthlyIndexTemplate(); - GetIndexRequest getIndexRequest = new GetIndexRequest(indexName + "*" + INDEX_DATE_PREFIX + "*"); + GetIndexRequest getIndexRequest = new GetIndexRequest(indexPrefix + "*" + INDEX_DATE_PREFIX + "*"); if (client.indices().exists(getIndexRequest, RequestOptions.DEFAULT)) { - createMapping(type, source, indexName + "*" + INDEX_DATE_PREFIX + "*"); + createMapping(type, source, indexPrefix + "*" + INDEX_DATE_PREFIX + "*"); } } else if (indexNames.containsKey(type)) { GetIndexRequest getIndexRequest = new GetIndexRequest(indexNames.get(type)); @@ -1015,7 +1008,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, createMapping(type, source, indexNames.get(type)); } } else { - createMapping(type, source, indexName); + createMapping(type, source, getIndex(type, new Date())); } } catch (IOException ioe) { logger.error("Error while creating mapping for type " + type + " and source " + source, ioe); @@ -1306,7 +1299,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder() .fetchSource(true) .query(query) - .size(size) + .size(size < 0 ? defaultQueryLimit : size) .from(offset); if (scrollTimeValidity != null) { keepAlive = TimeValue.parseTimeValue(scrollTimeValidity, TimeValue.timeValueHours(1), "scrollTimeValidity"); @@ -1680,7 +1673,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, BulkRequest deleteByScopeBulkRequest = new BulkRequest(); final TimeValue keepAlive = TimeValue.timeValueHours(1); - SearchRequest searchRequest = new SearchRequest(indexName + "*").scroll(keepAlive); + SearchRequest searchRequest = new SearchRequest(indexPrefix + "*").scroll(keepAlive); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder() .query(query) .size(100); @@ -1782,7 +1775,7 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, private String getIndexNameForQuery(String itemType) { return indexNames.containsKey(itemType) ? indexNames.get(itemType) : - (itemsMonthlyIndexed.contains(itemType) ? indexName + "*" + INDEX_DATE_PREFIX + "*" : indexName); + (itemsMonthlyIndexed.contains(itemType) ? indexPrefix + "*" + INDEX_DATE_PREFIX + "*" : getIndex(itemType, null)); } private String getConfig(Map<String, String> settings, String key, @@ -1873,11 +1866,11 @@ public class ElasticSearchPersistenceServiceImpl implements PersistenceService, String indexItemTypePart = indexNames.containsKey(itemType) ? indexNames.get(itemType) : (itemsMonthlyIndexed.contains(itemType) && dateHint != null ? itemType + "-" + getMonthlyIndexPart(dateHint) : itemType); - return indexName + "-" + indexItemTypePart; + return (indexPrefix + "-" + indexItemTypePart).toLowerCase(); } private String getMonthlyIndexPart(Date date) { - String d = new SimpleDateFormat("-yyyy-MM").format(date); + String d = new SimpleDateFormat("yyyy-MM").format(date); return INDEX_DATE_PREFIX + d; } 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/actiontype.json similarity index 80% copy from persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json copy to persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/actiontype.json index 829091a..e1ac5f8 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/actiontype.json @@ -16,11 +16,5 @@ } } } - ], - "properties": { - "timeStamp": { - "type": "date" - } - } -} - + ] +} \ No newline at end of file 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 6290fb6..d0ed2d3 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 @@ -17,31 +17,31 @@ } } ], - "properties": { - "cost": { - "type": "double" - }, - "startDate": { - "type": "date" - }, - "endDate": { - "type": "date" - }, - "metadata": { - "properties": { - "enabled": { - "type": "boolean" - }, - "hidden": { - "type": "boolean" - }, - "missingPlugins": { - "type": "boolean" - }, - "readOnly": { - "type": "boolean" - } + "properties": { + "cost": { + "type": "double" + }, + "startDate": { + "type": "date" + }, + "endDate": { + "type": "date" + }, + "metadata": { + "properties": { + "enabled": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "missingPlugins": { + "type": "boolean" + }, + "readOnly": { + "type": "boolean" } } } + } } \ No newline at end of file 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 9b05a7f..7d6a564 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 @@ -18,27 +18,27 @@ } ], "properties": { - "cost": { - "type": "double" - }, - "eventDate": { - "type": "date" - }, - "metadata": { - "properties": { - "enabled": { - "type": "boolean" - }, - "hidden": { - "type": "boolean" - }, - "missingPlugins": { - "type": "boolean" - }, - "readOnly": { - "type": "boolean" - } + "cost": { + "type": "double" + }, + "eventDate": { + "type": "date" + }, + "metadata": { + "properties": { + "enabled": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "missingPlugins": { + "type": "boolean" + }, + "readOnly": { + "type": "boolean" } } } + } } \ No newline at end of file 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/conditiontype.json similarity index 80% copy from persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json copy to persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/conditiontype.json index 829091a..e1ac5f8 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/conditiontype.json @@ -16,11 +16,5 @@ } } } - ], - "properties": { - "timeStamp": { - "type": "date" - } - } -} - + ] +} \ No newline at end of file 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 829091a..ca8c404 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 @@ -17,10 +17,10 @@ } } ], - "properties": { - "timeStamp": { - "type": "date" - } + "properties": { + "timeStamp": { + "type": "date" } + } } 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/exportconfig.json similarity index 80% copy from persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json copy to persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/exportconfig.json index 829091a..e1ac5f8 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/exportconfig.json @@ -16,11 +16,5 @@ } } } - ], - "properties": { - "timeStamp": { - "type": "date" - } - } -} - + ] +} \ No newline at end of file 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 9627340..3d3322b 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 @@ -18,22 +18,21 @@ } ], "properties": { - - "metadata": { - "properties": { - "enabled": { - "type": "boolean" - }, - "hidden": { - "type": "boolean" - }, - "missingPlugins": { - "type": "boolean" - }, - "readOnly": { - "type": "boolean" - } + "metadata": { + "properties": { + "enabled": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "missingPlugins": { + "type": "boolean" + }, + "readOnly": { + "type": "boolean" } } } + } } \ No newline at end of file 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/importconfig.json similarity index 80% copy from persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json copy to persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/importconfig.json index 829091a..e1ac5f8 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/importconfig.json @@ -16,11 +16,5 @@ } } } - ], - "properties": { - "timeStamp": { - "type": "date" - } - } -} - + ] +} \ No newline at end of file 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/persona.json similarity index 59% copy from persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/profile.json copy to persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/persona.json index 2fef62f..d014245 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/persona.json @@ -18,22 +18,21 @@ } ], "properties": { - + "properties": { "properties": { - "properties": { - "firstVisit": { - "type": "date" - }, - "lastVisit": { - "type": "date" - }, - "previousVisit": { - "type": "date" - }, - "nbOfVisits": { - "type": "long" - } + "firstVisit": { + "type": "date" + }, + "lastVisit": { + "type": "date" + }, + "previousVisit": { + "type": "date" + }, + "nbOfVisits": { + "type": "long" } } } + } } \ No newline at end of file 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 901266d..c635e02 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 @@ -18,25 +18,24 @@ } ], "properties": { - "duration" : { - "type" : "long" - }, - - "timeStamp": { - "type": "date" - }, - "lastEventDate": { - "type": "date" - }, - "properties" : { - "properties" : { - "location" : { - "type" : "geo_point" - } + "duration": { + "type": "long" + }, + "timeStamp": { + "type": "date" + }, + "lastEventDate": { + "type": "date" + }, + "properties": { + "properties": { + "location": { + "type": "geo_point" } - }, - "size" : { - "type" : "long" } + }, + "size": { + "type": "long" } + } } \ No newline at end of file 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 2fef62f..d014245 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 @@ -18,22 +18,21 @@ } ], "properties": { - + "properties": { "properties": { - "properties": { - "firstVisit": { - "type": "date" - }, - "lastVisit": { - "type": "date" - }, - "previousVisit": { - "type": "date" - }, - "nbOfVisits": { - "type": "long" - } + "firstVisit": { + "type": "date" + }, + "lastVisit": { + "type": "date" + }, + "previousVisit": { + "type": "date" + }, + "nbOfVisits": { + "type": "long" } } } + } } \ No newline at end of file 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 6adbd2a..3898c8c 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 @@ -18,44 +18,44 @@ } ], "properties": { - "dateRanges": { - "properties": { - } - }, - "metadata": { - "properties": { - "enabled": { - "type": "boolean" - }, - "hidden": { - "type": "boolean" - }, - "missingPlugins": { - "type": "boolean" - }, - "readOnly": { - "type": "boolean" - } + "dateRanges": { + "properties": { + } + }, + "metadata": { + "properties": { + "enabled": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "missingPlugins": { + "type": "boolean" + }, + "readOnly": { + "type": "boolean" } - }, - "multivalued": { - "type": "boolean" - }, - "numericRanges": { - "properties": { - "from": { - "type": "double" - }, - "to": { - "type": "double" - } + } + }, + "multivalued": { + "type": "boolean" + }, + "numericRanges": { + "properties": { + "from": { + "type": "double" + }, + "to": { + "type": "double" } - }, - "protected": { - "type": "boolean" - }, - "rank": { - "type": "double" } + }, + "protected": { + "type": "boolean" + }, + "rank": { + "type": "double" } + } } \ No newline at end of file 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 3561e61..2027c2f 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 @@ -18,30 +18,30 @@ } ], "properties": { - "metadata": { - "properties": { - "enabled": { - "type": "boolean" - }, - "hidden": { - "type": "boolean" - }, - "missingPlugins": { - "type": "boolean" - }, - "readOnly": { - "type": "boolean" - } + "metadata": { + "properties": { + "enabled": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "missingPlugins": { + "type": "boolean" + }, + "readOnly": { + "type": "boolean" } - }, - "priority": { - "type": "long" - }, - "raiseEventOnlyOnceForProfile": { - "type": "boolean" - }, - "raiseEventOnlyOnceForSession": { - "type": "boolean" } + }, + "priority": { + "type": "long" + }, + "raiseEventOnlyOnceForProfile": { + "type": "boolean" + }, + "raiseEventOnlyOnceForSession": { + "type": "boolean" } + } } \ No newline at end of file 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/rulestats.json similarity index 80% copy from persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/event.json copy to persistence-elasticsearch/core/src/main/resources/META-INF/cxs/mappings/rulestats.json index 829091a..e1ac5f8 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/rulestats.json @@ -16,11 +16,5 @@ } } } - ], - "properties": { - "timeStamp": { - "type": "date" - } - } -} - + ] +} \ No newline at end of file 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 8e256dd..dd890c7 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 @@ -17,23 +17,22 @@ } } ], - "properties": { - - "metadata": { - "properties": { - "enabled": { - "type": "boolean" - }, - "hidden": { - "type": "boolean" - }, - "missingPlugins": { - "type": "boolean" - }, - "readOnly": { - "type": "boolean" - } + "properties": { + "metadata": { + "properties": { + "enabled": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "missingPlugins": { + "type": "boolean" + }, + "readOnly": { + "type": "boolean" } } } + } } 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 fa93d5b..dd890c7 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 @@ -17,24 +17,22 @@ } } ], - "properties": { - - "metadata": { - "properties": { - "enabled": { - "type": "boolean" - }, - "hidden": { - "type": "boolean" - }, - - "missingPlugins": { - "type": "boolean" - }, - "readOnly": { - "type": "boolean" - } + "properties": { + "metadata": { + "properties": { + "enabled": { + "type": "boolean" + }, + "hidden": { + "type": "boolean" + }, + "missingPlugins": { + "type": "boolean" + }, + "readOnly": { + "type": "boolean" } } } + } } 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 7cc4061..dc1ae46 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 @@ -18,27 +18,24 @@ } ], "properties": { - "duration": { - "type": "long" - }, - - "lastEventDate": { - "type": "date" - }, - + "duration": { + "type": "long" + }, + "lastEventDate": { + "type": "date" + }, + "properties": { "properties": { - "properties": { - "location": { - "type": "geo_point" - } + "location": { + "type": "geo_point" } - }, - - "size": { - "type": "long" - }, - "timeStamp": { - "type": "date" } + }, + "size": { + "type": "long" + }, + "timeStamp": { + "type": "date" } + } } \ No newline at end of file diff --git a/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml index dadf585..f3a937e 100644 --- a/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -32,7 +32,7 @@ <cm:default-properties> <cm:property name="cluster.name" value="contextElasticSearch"/> <cm:property name="elasticSearchAddresses" value="localhost:9200"/> - <cm:property name="index.name" value="context"/> + <cm:property name="index.prefix" value="context"/> <cm:property name="numberOfShards" value="5"/> <cm:property name="numberOfReplicas" value="0"/> <cm:property name="monthlyIndex.numberOfShards" value="3"/> @@ -83,7 +83,7 @@ <property name="conditionEvaluatorDispatcher" ref="conditionEvaluatorDispatcherImpl"/> <property name="conditionESQueryBuilderDispatcher" ref="conditionESQueryBuilderDispatcher"/> <property name="clusterName" value="${es.cluster.name}"/> - <property name="indexName" value="${es.index.name}"/> + <property name="indexPrefix" value="${es.index.prefix}"/> <property name="monthlyIndexNumberOfShards" value="${es.monthlyIndex.numberOfShards}"/> <property name="monthlyIndexNumberOfReplicas" value="${es.monthlyIndex.numberOfReplicas}"/> <property name="numberOfShards" value="${es.numberOfShards}"/> @@ -100,11 +100,6 @@ <map> </map> </property> - <property name="indexNames"> - <map> - <entry key="geonameEntry" value="geonames"/> - </map> - </property> <property name="bulkProcessorConcurrentRequests" value="${es.bulkProcessor.concurrentRequests}" /> <property name="bulkProcessorBulkActions" value="${es.bulkProcessor.bulkActions}" /> <property name="bulkProcessorBulkSize" value="${es.bulkProcessor.bulkSize}" /> diff --git a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg index 8e7dc7b..a21e86e 100644 --- a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg +++ b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg @@ -20,7 +20,7 @@ cluster.name=${org.apache.unomi.elasticsearch.cluster.name:-contextElasticSearch # hostA:9200,hostB:9200 # Note: the port number must be repeated for each host. elasticSearchAddresses=${org.apache.unomi.elasticsearch.addresses:-localhost:9200} -index.name=${org.apache.unomi.elasticsearch.index.name:-context} +index.prefix=${org.apache.unomi.elasticsearch.index.prefix:-context} monthlyIndex.numberOfShards=${org.apache.unomi.elasticsearch.monthlyIndex.nbShards:-5} monthlyIndex.numberOfReplicas=${org.apache.unomi.elasticsearch.monthlyIndex.nbReplicas:-0} numberOfShards=${org.apache.unomi.elasticsearch.defaultIndex.nbShards:-5}
