diff --git a/es/account/mapping.json b/es/account/mapping.json new file mode 100644 index 000000000..5ddf17753 --- /dev/null +++ b/es/account/mapping.json @@ -0,0 +1,52 @@ +{ + "dynamic": false, + "properties": { + "access_token": { + "dynamic": true, + "properties": { + "client": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "token": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } + }, + "code": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "id": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "identity": { + "dynamic": false, + "properties": { + "key": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "name": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } + }, + "looks_human": { + "type": "boolean" + }, + "passed_captcha": { + "format": "strict_date_optional_time||epoch_millis", + "type": "date" + } + } +} diff --git a/es/account/settings.json b/es/account/settings.json new file mode 100644 index 000000000..c90ef6cba --- /dev/null +++ b/es/account/settings.json @@ -0,0 +1,8 @@ +{ + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/author/mapping.json b/es/author/mapping.json new file mode 100644 index 000000000..ad9278a7f --- /dev/null +++ b/es/author/mapping.json @@ -0,0 +1,157 @@ +{ + "dynamic": false, + "properties": { + "asciiname": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "blog": { + "dynamic": true, + "properties": { + "feed": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "url": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } + }, + "city": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "country": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "donation": { + "dynamic": true, + "properties": { + "id": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "name": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } + }, + "email": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "gravatar_url": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "is_pause_custodial_account": { + "type": "boolean" + }, + "location": { + "type": "geo_point" + }, + "name": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "pauseid": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "perlmongers": { + "dynamic": true, + "properties": { + "name": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "url": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } + }, + "profile": { + "dynamic": false, + "include_in_root": true, + "properties": { + "id": { + "fields": { + "analyzed": { + "analyzer": "simple", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "name": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + }, + "type": "nested" + }, + "region": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "updated": { + "format": "strict_date_optional_time||epoch_millis", + "type": "date" + }, + "user": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "website": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } +} diff --git a/es/author/settings.json b/es/author/settings.json new file mode 100644 index 000000000..c90ef6cba --- /dev/null +++ b/es/author/settings.json @@ -0,0 +1,8 @@ +{ + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/contributor/mapping.json b/es/contributor/mapping.json new file mode 100644 index 000000000..605c8f923 --- /dev/null +++ b/es/contributor/mapping.json @@ -0,0 +1,25 @@ +{ + "dynamic": false, + "properties": { + "distribution": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "pauseid": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "release_author": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "release_name": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } +} diff --git a/es/contributor/settings.json b/es/contributor/settings.json new file mode 100644 index 000000000..c90ef6cba --- /dev/null +++ b/es/contributor/settings.json @@ -0,0 +1,8 @@ +{ + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/cover/mapping.json b/es/cover/mapping.json new file mode 100644 index 000000000..e0a6a6114 --- /dev/null +++ b/es/cover/mapping.json @@ -0,0 +1,40 @@ +{ + "dynamic": false, + "properties": { + "criteria": { + "dynamic": true, + "properties": { + "branch": { + "type": "float" + }, + "condition": { + "type": "float" + }, + "statement": { + "type": "float" + }, + "subroutine": { + "type": "float" + }, + "total": { + "type": "float" + } + } + }, + "distribution": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "release": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "version": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } +} diff --git a/es/cover/settings.json b/es/cover/settings.json new file mode 100644 index 000000000..c90ef6cba --- /dev/null +++ b/es/cover/settings.json @@ -0,0 +1,8 @@ +{ + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/cve/mapping.json b/es/cve/mapping.json new file mode 100644 index 000000000..4f3492037 --- /dev/null +++ b/es/cve/mapping.json @@ -0,0 +1,41 @@ +{ + "dynamic": false, + "properties": { + "affected_versions": { + "type": "string" + }, + "cpansa_id": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "cves": { + "type": "string" + }, + "description": { + "type": "string" + }, + "distribution": { + "index": "not_analyzed", + "type": "string" + }, + "references": { + "type": "string" + }, + "releases": { + "index": "not_analyzed", + "type": "string" + }, + "reported": { + "format": "strict_date_optional_time||epoch_millis", + "type": "date" + }, + "severity": { + "type": "string" + }, + "versions": { + "index": "not_analyzed", + "type": "string" + } + } +} diff --git a/es/cve/settings.json b/es/cve/settings.json new file mode 100644 index 000000000..c90ef6cba --- /dev/null +++ b/es/cve/settings.json @@ -0,0 +1,8 @@ +{ + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/distribution/mapping.json b/es/distribution/mapping.json new file mode 100644 index 000000000..333927a24 --- /dev/null +++ b/es/distribution/mapping.json @@ -0,0 +1,121 @@ +{ + "dynamic": false, + "properties": { + "bugs": { + "dynamic": true, + "properties": { + "github": { + "dynamic": true, + "properties": { + "active": { + "type": "integer" + }, + "closed": { + "type": "integer" + }, + "open": { + "type": "integer" + }, + "source": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } + }, + "rt": { + "dynamic": true, + "properties": { + "active": { + "type": "integer" + }, + "closed": { + "type": "integer" + }, + "new": { + "type": "integer" + }, + "open": { + "type": "integer" + }, + "patched": { + "type": "integer" + }, + "rejected": { + "type": "integer" + }, + "resolved": { + "type": "integer" + }, + "source": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "stalled": { + "type": "integer" + } + } + } + } + }, + "external_package": { + "dynamic": true, + "properties": { + "cygwin": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "debian": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "fedora": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } + }, + "name": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "repo": { + "dynamic": true, + "properties": { + "github": { + "dynamic": true, + "properties": { + "stars": { + "type": "integer" + }, + "watchers": { + "type": "integer" + } + } + } + } + }, + "river": { + "dynamic": true, + "properties": { + "bucket": { + "type": "integer" + }, + "bus_factor": { + "type": "integer" + }, + "immediate": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + } + } +} diff --git a/es/distribution/settings.json b/es/distribution/settings.json new file mode 100644 index 000000000..c90ef6cba --- /dev/null +++ b/es/distribution/settings.json @@ -0,0 +1,8 @@ +{ + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/favorite/mapping.json b/es/favorite/mapping.json new file mode 100644 index 000000000..aeff5b2cb --- /dev/null +++ b/es/favorite/mapping.json @@ -0,0 +1,34 @@ +{ + "dynamic": false, + "properties": { + "author": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "date": { + "format": "strict_date_optional_time||epoch_millis", + "type": "date" + }, + "distribution": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "id": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "release": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "user": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } +} diff --git a/es/favorite/settings.json b/es/favorite/settings.json new file mode 100644 index 000000000..c90ef6cba --- /dev/null +++ b/es/favorite/settings.json @@ -0,0 +1,8 @@ +{ + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/file/mapping.json b/es/file/mapping.json new file mode 100644 index 000000000..5374d9f41 --- /dev/null +++ b/es/file/mapping.json @@ -0,0 +1,293 @@ +{ + "dynamic": false, + "properties": { + "abstract": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "author": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "authorized": { + "type": "boolean" + }, + "binary": { + "type": "boolean" + }, + "date": { + "format": "strict_date_optional_time||epoch_millis", + "type": "date" + }, + "deprecated": { + "type": "boolean" + }, + "description": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "dir": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "directory": { + "type": "boolean" + }, + "dist_fav_count": { + "type": "integer" + }, + "distribution": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + }, + "camelcase": { + "analyzer": "camelcase", + "store": true, + "type": "string" + }, + "lowercase": { + "analyzer": "lowercase", + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "documentation": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + }, + "camelcase": { + "analyzer": "camelcase", + "store": true, + "type": "string" + }, + "edge": { + "analyzer": "edge", + "store": true, + "type": "string" + }, + "edge_camelcase": { + "analyzer": "edge_camelcase", + "store": true, + "type": "string" + }, + "lowercase": { + "analyzer": "lowercase", + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "documentation_length": { + "type": "integer" + }, + "download_url": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "id": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "indexed": { + "type": "boolean" + }, + "level": { + "type": "integer" + }, + "maturity": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "mime": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "module": { + "dynamic": false, + "include_in_root": true, + "properties": { + "associated_pod": { + "type": "string" + }, + "authorized": { + "type": "boolean" + }, + "indexed": { + "type": "boolean" + }, + "name": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + }, + "camelcase": { + "analyzer": "camelcase", + "store": true, + "type": "string" + }, + "lowercase": { + "analyzer": "lowercase", + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "version": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "version_numified": { + "type": "float" + } + }, + "type": "nested" + }, + "name": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "path": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "pod": { + "analyzer": "standard", + "doc_values": false, + "fields": { + "analyzed": { + "analyzer": "standard", + "doc_values": false, + "index": "analyzed", + "type": "string" + } + }, + "index": "analyzed", + "type": "string" + }, + "pod_lines": { + "doc_values": true, + "ignore_above": 2048, + "index": "no", + "type": "string" + }, + "release": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + }, + "camelcase": { + "analyzer": "camelcase", + "store": true, + "type": "string" + }, + "lowercase": { + "analyzer": "lowercase", + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "sloc": { + "type": "integer" + }, + "slop": { + "type": "integer" + }, + "stat": { + "dynamic": true, + "properties": { + "gid": { + "type": "long" + }, + "mode": { + "type": "integer" + }, + "mtime": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "uid": { + "type": "long" + } + } + }, + "status": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "suggest": { + "analyzer": "simple", + "max_input_length": 50, + "preserve_position_increments": true, + "preserve_separators": true, + "type": "completion" + }, + "version": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "version_numified": { + "type": "float" + } + } +} diff --git a/es/file/settings.json b/es/file/settings.json new file mode 100644 index 000000000..1d4845446 --- /dev/null +++ b/es/file/settings.json @@ -0,0 +1,56 @@ +{ + "analysis": { + "analyzer": { + "camelcase": { + "filter": [ + "lowercase", + "unique" + ], + "tokenizer": "camelcase", + "type": "custom" + }, + "edge": { + "filter": [ + "lowercase", + "edge" + ], + "tokenizer": "standard", + "type": "custom" + }, + "edge_camelcase": { + "filter": [ + "lowercase", + "edge" + ], + "tokenizer": "camelcase", + "type": "custom" + }, + "fulltext": { + "type": "english" + }, + "lowercase": { + "filter": "lowercase", + "tokenizer": "keyword" + } + }, + "filter": { + "edge": { + "max_gram": "20", + "min_gram": "1", + "type": "edge_ngram" + } + }, + "tokenizer": { + "camelcase": { + "pattern": "([^\\p{L}\\d]+)|(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)|(?<=[\\p{L}&&[^\\p{Lu}]])(?=\\p{Lu})|(?<=\\p{Lu})(?=\\p{Lu}[\\p{L}&&[^\\p{Lu}]])", + "type": "pattern" + } + } + }, + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/identity/mapping.json b/es/identity/mapping.json new file mode 100644 index 000000000..340886289 --- /dev/null +++ b/es/identity/mapping.json @@ -0,0 +1,15 @@ +{ + "dynamic": false, + "properties": { + "key": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "name": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } +} diff --git a/es/identity/settings.json b/es/identity/settings.json new file mode 100644 index 000000000..c90ef6cba --- /dev/null +++ b/es/identity/settings.json @@ -0,0 +1,8 @@ +{ + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/mirror/mapping.json b/es/mirror/mapping.json new file mode 100644 index 000000000..09f2d85e1 --- /dev/null +++ b/es/mirror/mapping.json @@ -0,0 +1,166 @@ +{ + "dynamic": false, + "properties": { + "A_or_CNAME": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "aka_name": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "ccode": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "city": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "contact": { + "dynamic": false, + "properties": { + "contact_site": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "contact_user": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } + }, + "continent": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "country": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "dnsrr": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "freq": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "ftp": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "http": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "inceptdate": { + "format": "strict_date_optional_time||epoch_millis", + "type": "date" + }, + "location": { + "type": "geo_point" + }, + "name": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "note": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "org": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "region": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "reitredate": { + "format": "strict_date_optional_time||epoch_millis", + "type": "date" + }, + "rsync": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "src": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "tz": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } +} diff --git a/es/mirror/settings.json b/es/mirror/settings.json new file mode 100644 index 000000000..c90ef6cba --- /dev/null +++ b/es/mirror/settings.json @@ -0,0 +1,8 @@ +{ + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/package/mapping.json b/es/package/mapping.json new file mode 100644 index 000000000..82dacee1e --- /dev/null +++ b/es/package/mapping.json @@ -0,0 +1,35 @@ +{ + "dynamic": false, + "properties": { + "author": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "dist_version": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "distribution": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "file": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "module_name": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "version": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } +} diff --git a/es/package/settings.json b/es/package/settings.json new file mode 100644 index 000000000..c90ef6cba --- /dev/null +++ b/es/package/settings.json @@ -0,0 +1,8 @@ +{ + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/permission/mapping.json b/es/permission/mapping.json new file mode 100644 index 000000000..688f56bcd --- /dev/null +++ b/es/permission/mapping.json @@ -0,0 +1,20 @@ +{ + "dynamic": false, + "properties": { + "co_maintainers": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "module_name": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "owner": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + } +} diff --git a/es/permission/settings.json b/es/permission/settings.json new file mode 100644 index 000000000..c90ef6cba --- /dev/null +++ b/es/permission/settings.json @@ -0,0 +1,8 @@ +{ + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/release/mapping.json b/es/release/mapping.json new file mode 100644 index 000000000..fb75ac875 --- /dev/null +++ b/es/release/mapping.json @@ -0,0 +1,271 @@ +{ + "dynamic": false, + "properties": { + "abstract": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "archive": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "author": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "authorized": { + "type": "boolean" + }, + "changes_file": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "checksum_md5": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "checksum_sha256": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "date": { + "format": "strict_date_optional_time||epoch_millis", + "type": "date" + }, + "dependency": { + "dynamic": false, + "include_in_root": true, + "properties": { + "module": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "phase": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "relationship": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "version": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + }, + "type": "nested" + }, + "deprecated": { + "type": "boolean" + }, + "distribution": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + }, + "camelcase": { + "analyzer": "camelcase", + "store": true, + "type": "string" + }, + "lowercase": { + "analyzer": "lowercase", + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "download_url": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "first": { + "type": "boolean" + }, + "id": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "license": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "main_module": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "maturity": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "name": { + "fields": { + "analyzed": { + "analyzer": "standard", + "fielddata": { + "format": "disabled" + }, + "store": true, + "type": "string" + }, + "camelcase": { + "analyzer": "camelcase", + "store": true, + "type": "string" + }, + "lowercase": { + "analyzer": "lowercase", + "store": true, + "type": "string" + } + }, + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "provides": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "resources": { + "dynamic": true, + "include_in_root": true, + "properties": { + "bugtracker": { + "dynamic": "true", + "include_in_root": true, + "properties": { + "mailto": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "web": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + }, + "type": "nested" + }, + "homepage": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "license": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "repository": { + "dynamic": "true", + "include_in_root": true, + "properties": { + "type": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "url": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "web": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + } + }, + "type": "nested" + } + }, + "type": "nested" + }, + "stat": { + "dynamic": true, + "properties": { + "gid": { + "type": "long" + }, + "mode": { + "type": "integer" + }, + "mtime": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "uid": { + "type": "long" + } + } + }, + "status": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "tests": { + "dynamic": true, + "properties": { + "fail": { + "type": "integer" + }, + "na": { + "type": "integer" + }, + "pass": { + "type": "integer" + }, + "unknown": { + "type": "integer" + } + } + }, + "version": { + "ignore_above": 2048, + "index": "not_analyzed", + "type": "string" + }, + "version_numified": { + "type": "float" + } + } +} diff --git a/es/release/settings.json b/es/release/settings.json new file mode 100644 index 000000000..1d4845446 --- /dev/null +++ b/es/release/settings.json @@ -0,0 +1,56 @@ +{ + "analysis": { + "analyzer": { + "camelcase": { + "filter": [ + "lowercase", + "unique" + ], + "tokenizer": "camelcase", + "type": "custom" + }, + "edge": { + "filter": [ + "lowercase", + "edge" + ], + "tokenizer": "standard", + "type": "custom" + }, + "edge_camelcase": { + "filter": [ + "lowercase", + "edge" + ], + "tokenizer": "camelcase", + "type": "custom" + }, + "fulltext": { + "type": "english" + }, + "lowercase": { + "filter": "lowercase", + "tokenizer": "keyword" + } + }, + "filter": { + "edge": { + "max_gram": "20", + "min_gram": "1", + "type": "edge_ngram" + } + }, + "tokenizer": { + "camelcase": { + "pattern": "([^\\p{L}\\d]+)|(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)|(?<=[\\p{L}&&[^\\p{Lu}]])(?=\\p{Lu})|(?<=\\p{Lu})(?=\\p{Lu}[\\p{L}&&[^\\p{Lu}]])", + "type": "pattern" + } + } + }, + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/session/mapping.json b/es/session/mapping.json new file mode 100644 index 000000000..d4f130c22 --- /dev/null +++ b/es/session/mapping.json @@ -0,0 +1,3 @@ +{ + "dynamic": false +} diff --git a/es/session/settings.json b/es/session/settings.json new file mode 100644 index 000000000..c90ef6cba --- /dev/null +++ b/es/session/settings.json @@ -0,0 +1,8 @@ +{ + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/es/settings.json b/es/settings.json new file mode 100644 index 000000000..1d4845446 --- /dev/null +++ b/es/settings.json @@ -0,0 +1,56 @@ +{ + "analysis": { + "analyzer": { + "camelcase": { + "filter": [ + "lowercase", + "unique" + ], + "tokenizer": "camelcase", + "type": "custom" + }, + "edge": { + "filter": [ + "lowercase", + "edge" + ], + "tokenizer": "standard", + "type": "custom" + }, + "edge_camelcase": { + "filter": [ + "lowercase", + "edge" + ], + "tokenizer": "camelcase", + "type": "custom" + }, + "fulltext": { + "type": "english" + }, + "lowercase": { + "filter": "lowercase", + "tokenizer": "keyword" + } + }, + "filter": { + "edge": { + "max_gram": "20", + "min_gram": "1", + "type": "edge_ngram" + } + }, + "tokenizer": { + "camelcase": { + "pattern": "([^\\p{L}\\d]+)|(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)|(?<=[\\p{L}&&[^\\p{Lu}]])(?=\\p{Lu})|(?<=\\p{Lu})(?=\\p{Lu}[\\p{L}&&[^\\p{Lu}]])", + "type": "pattern" + } + } + }, + "mapper": { + "dynamic": "false" + }, + "number_of_replicas": 1, + "number_of_shards": 1, + "refresh_interval": "1s" +} diff --git a/lib/MetaCPAN/ESConfig.pm b/lib/MetaCPAN/ESConfig.pm index 801f09682..d06a53998 100644 --- a/lib/MetaCPAN/ESConfig.pm +++ b/lib/MetaCPAN/ESConfig.pm @@ -17,100 +17,105 @@ use Const::Fast qw(const); const my %config => merge( { - aliases => { - 'cpan' => 'cpan_v1_01', - }, - indexes => { - _default => { - settings => - 'MetaCPAN::Script::Mapping::DeployStatement::mapping()', - }, - }, documents => { author => { - index => 'cpan_v1_01', - type => 'author', - mapping => 'MetaCPAN::Script::Mapping::CPAN::Author', - model => 'MetaCPAN::Document::Author', + index => 'author', + type => 'author', + mapping => 'es/author/mapping.json', + settings => 'es/author/settings.json', + model => 'MetaCPAN::Document::Author', }, cve => { - index => 'cve', - type => 'cve', - mapping => 'MetaCPAN::Script::Mapping::CVE', - model => 'MetaCPAN::Document::CVE', + index => 'cve', + type => 'cve', + mapping => 'es/cve/mapping.json', + settings => 'es/cve/settings.json', + model => 'MetaCPAN::Document::CVE', }, contributor => { - index => 'contributor', - type => 'contributor', - mapping => 'MetaCPAN::Script::Mapping::Contributor', - model => 'MetaCPAN::Document::Contributor', + index => 'contributor', + type => 'contributor', + mapping => 'es/contributor/mapping.json', + settings => 'es/contributor/settings.json', + model => 'MetaCPAN::Document::Contributor', }, cover => { - index => 'cover', - type => 'cover', - mapping => 'MetaCPAN::Script::Mapping::Cover', - model => 'MetaCPAN::Document::Cover', + index => 'cover', + type => 'cover', + mapping => 'es/cover/mapping.json', + settings => 'es/cover/settings.json', + model => 'MetaCPAN::Document::Cover', }, distribution => { - index => 'cpan_v1_01', - type => 'distribution', - mapping => 'MetaCPAN::Script::Mapping::CPAN::Distribution', - model => 'MetaCPAN::Document::Distribution', + index => 'distribution', + type => 'distribution', + mapping => 'es/distribution/mapping.json', + settings => 'es/distribution/settings.json', + model => 'MetaCPAN::Document::Distribution', }, favorite => { - index => 'cpan_v1_01', - type => 'favorite', - mapping => 'MetaCPAN::Script::Mapping::CPAN::Favorite', - model => 'MetaCPAN::Document::Favorite', + index => 'favorite', + type => 'favorite', + mapping => 'es/favorite/mapping.json', + settings => 'es/favorite/settings.json', + model => 'MetaCPAN::Document::Favorite', }, file => { - index => 'cpan_v1_01', - type => 'file', - mapping => 'MetaCPAN::Script::Mapping::CPAN::File', - model => 'MetaCPAN::Document::File', + index => 'file', + type => 'file', + mapping => 'es/file/mapping.json', + settings => 'es/file/settings.json', + model => 'MetaCPAN::Document::File', }, mirror => { - index => 'cpan_v1_01', - type => 'mirror', - mapping => 'MetaCPAN::Script::Mapping::CPAN::Mirror', - model => 'MetaCPAN::Document::Mirror', + index => 'mirror', + type => 'mirror', + mapping => 'es/mirror/mapping.json', + settings => 'es/mirror/settings.json', + model => 'MetaCPAN::Document::Mirror', }, package => { - index => 'cpan_v1_01', - type => 'package', - mapping => 'MetaCPAN::Script::Mapping::CPAN::Package', - model => 'MetaCPAN::Document::Package', + index => 'package', + type => 'package', + mapping => 'es/package/mapping.json', + settings => 'es/package/settings.json', + model => 'MetaCPAN::Document::Package', }, permission => { - index => 'cpan_v1_01', - type => 'permission', - mapping => 'MetaCPAN::Script::Mapping::CPAN::Permission', - model => 'MetaCPAN::Document::Permission', + index => 'permission', + type => 'permission', + mapping => 'es/permission/mapping.json', + settings => 'es/permission/settings.json', + model => 'MetaCPAN::Document::Permission', }, release => { - index => 'cpan_v1_01', - type => 'release', - mapping => 'MetaCPAN::Script::Mapping::CPAN::Release', - model => 'MetaCPAN::Document::Release', + index => 'release', + type => 'release', + mapping => 'es/release/mapping.json', + settings => 'es/release/settings.json', + model => 'MetaCPAN::Document::Release', }, account => { - index => 'user', - type => 'account', - mapping => 'MetaCPAN::Script::Mapping::User::Account', - model => 'MetaCPAN::Model::User::Account', + index => 'account', + type => 'account', + mapping => 'es/account/mapping.json', + settings => 'es/account/settings.json', + model => 'MetaCPAN::Model::User::Account', }, identity => { - index => 'user', - type => 'identity', - mapping => 'MetaCPAN::Script::Mapping::User::Identity', - model => 'MetaCPAN::Model::User::Identity', + index => 'identity', + type => 'identity', + mapping => 'es/identity/mapping.json', + settings => 'es/identity/settings.json', + model => 'MetaCPAN::Model::User::Identity', }, session => { - index => 'user', - type => 'session', - mapping => 'MetaCPAN::Script::Mapping::User::Session', - model => 'MetaCPAN::Model::User::Session', + index => 'session', + type => 'session', + mapping => 'es/session/mapping.json', + settings => 'es/session/settings.json', + model => 'MetaCPAN::Model::User::Session', }, }, }, @@ -121,11 +126,6 @@ const my %config => merge( use Moo; } -has indexes => ( - is => 'ro', - required => 1, -); - has all_indexes => ( is => 'lazy', default => sub ($self) { @@ -150,12 +150,6 @@ my $DefinedHash = ( HashRef [Defined] )->plus_coercions( }; }, ); -has aliases => ( - is => 'ro', - isa => $DefinedHash, - coerce => 1, - default => sub { {} }, -); has documents => ( is => 'ro', @@ -164,7 +158,7 @@ has documents => ( required => 1, ); -sub _load_es_data ( $location, $def_sub = 'mapping' ) { +sub _load_es_data ( $location, $def_sub ) { my $data; if ( ref $location ) { @@ -207,24 +201,13 @@ sub mapping ( $self, $doc ) { return _load_es_data( $doc_data->{mapping}, 'mapping' ); } -sub index_settings ( $self, $index ) { - my $indexes = $self->indexes; - my $index_data = exists $indexes->{$index} && $indexes->{$index}; - my $settings - = $index_data - && exists $index_data->{settings} - && $index_data->{settings}; - if ( !$settings ) { - my $default_data - = exists $indexes->{_default} && $indexes->{_default}; - $settings - = $default_data - && exists $default_data->{settings} - && $default_data->{settings}; - } - return {} - if !$settings; - return _load_es_data($settings); +sub index_settings ( $self, $doc ) { + my $documents = $self->documents; + my $doc_data = exists $documents->{$doc} && $documents->{$doc} + or return {}; + my $settings = exists $doc_data->{settings} && $doc_data->{settings} + or return {}; + return _load_es_data( $settings, 'settings' ); } sub doc_path ( $self, $doc ) { diff --git a/lib/MetaCPAN/Model.pm b/lib/MetaCPAN/Model.pm index 52a0cfdea..fd17cab71 100644 --- a/lib/MetaCPAN/Model.pm +++ b/lib/MetaCPAN/Model.pm @@ -21,18 +21,6 @@ for my $name ( sort keys %$docs ) { $indexes{$index}{types}{$name} = $model->meta; } -my $aliases = es_config->aliases; -for my $alias ( sort keys %$aliases ) { - my $index = $aliases->{$alias}; - my $index_data = $indexes{$index} - or die "unknown index $index"; - if ( $index_data->{alias_for} ) { - die "duplicate alias for $index"; - } - $index_data->{alias_for} = $index; - $indexes{$alias} = delete $indexes{$index}; -} - for my $index ( sort keys %indexes ) { index $index => %{ $indexes{$index} }; } diff --git a/lib/MetaCPAN/Role/Script.pm b/lib/MetaCPAN/Role/Script.pm index cd6c46053..7d604f4bb 100644 --- a/lib/MetaCPAN/Role/Script.pm +++ b/lib/MetaCPAN/Role/Script.pm @@ -4,7 +4,6 @@ use Moose::Role; use Carp (); use MooseX::Types::ElasticSearch qw( ES ); -use File::Path (); use IO::Prompt::Tiny qw( prompt ); use Log::Contextual qw( :log :dlog ); use MetaCPAN::Model (); @@ -48,15 +47,6 @@ has exit_code => ( documentation => 'Exit Code to be returned on termination', ); -has arg_await_timeout => ( - init_arg => 'await', - is => 'ro', - isa => Int, - default => 15, - documentation => - 'seconds before connection is considered failed with timeout', -); - has ua => ( is => 'ro', lazy => 1, @@ -86,29 +76,6 @@ has model => ( traits => ['NoGetopt'], ); -has cluster_info => ( - isa => HashRef, - traits => ['Hash'], - is => 'rw', - lazy => 1, - default => sub { {} }, -); - -has indices_info => ( - isa => HashRef, - traits => ['Hash'], - is => 'rw', - lazy => 1, - default => sub { {} }, -); - -has aliases_info => ( - isa => HashRef, - traits => ['Hash'], - is => 'rw', - default => sub { {} }, -); - has port => ( isa => Int, is => 'ro', @@ -126,13 +93,6 @@ has home => ( default => sub { root_dir() }, ); -has quarantine => ( - is => 'ro', - isa => Str, - lazy => 1, - builder => '_build_quarantine', -); - has _minion => ( is => 'ro', isa => 'Minion', @@ -223,140 +183,12 @@ sub _build_cpan_file_map { return $cpan; } -sub _build_quarantine { - my $path = "$ENV{HOME}/QUARANTINE"; - if ( !-d $path ) { - File::Path::mkpath($path); - } - return $path; -} - -sub remote { - shift->es->nodes->info->[0]; -} - sub run { } before run => sub { my $self = shift; $self->set_logger_once; }; -sub _get_indices_info { - my ( $self, $irefresh ) = @_; - - if ( $irefresh || scalar( keys %{ $self->indices_info } ) == 0 ) { - my $sinfo_rs = $self->es->cat->indices( h => [ 'index', 'health' ] ); - my $sindices_parsing = qr/^([^[:space:]]+) +([^[:space:]]+)/m; - - $self->indices_info( {} ); - - while ( $sinfo_rs =~ /$sindices_parsing/g ) { - $self->indices_info->{$1} - = { 'index_name' => $1, 'health' => $2 }; - } - } -} - -sub _get_aliases_info { - my ( $self, $irefresh ) = @_; - - if ( $irefresh || scalar( keys %{ $self->aliases_info } ) == 0 ) { - my $sinfo_rs = $self->es->cat->aliases( h => [ 'alias', 'index' ] ); - my $saliases_parsing = qr/^([^[:space:]]+) +([^[:space:]]+)/m; - - $self->aliases_info( {} ); - - while ( $sinfo_rs =~ /$saliases_parsing/g ) { - $self->aliases_info->{$1} = { 'alias_name' => $1, 'index' => $2 }; - } - } -} - -sub check_health { - my ( $self, $irefresh ) = @_; - my $ihealth = 0; - - $irefresh = 0 unless ( defined $irefresh ); - - $ihealth = $self->await; - - if ($ihealth) { - $self->_get_indices_info($irefresh); - - foreach ( keys %{ $self->indices_info } ) { - $ihealth = 0 - if ( $self->indices_info->{$_}->{'health'} eq 'red' ); - } - } - - if ($ihealth) { - $self->_get_aliases_info($irefresh); - - $ihealth = 0 if ( scalar( keys %{ $self->aliases_info } ) == 0 ); - } - - return $ihealth; -} - -sub await { - my $self = $_[0]; - my $iready = 0; - - if ( scalar( keys %{ $self->cluster_info } ) == 0 ) { - my $es = $self->es; - my $iseconds = 0; - - log_info {"Awaiting Elasticsearch ..."}; - - do { - eval { - $iready = $es->ping; - - if ($iready) { - log_info { - "Awaiting $iseconds / " - . $self->arg_await_timeout - . " : ready" - }; - - $self->cluster_info( \%{ $es->info } ); - } - }; - - if ($@) { - if ( $iseconds < $self->arg_await_timeout ) { - log_info { - "Awaiting $iseconds / " - . $self->arg_await_timeout - . " : unavailable - sleeping ..." - }; - - sleep(1); - - $iseconds++; - } - else { - log_error { - "Awaiting $iseconds / " - . $self->arg_await_timeout - . " : unavailable - timeout!" - }; - - #Set System Error: 112 - EHOSTDOWN - Host is down - $self->exit_code(112); - $self->handle_error( $@, 1 ); - } - } - } while ( !$iready && $iseconds <= $self->arg_await_timeout ); - } - else { - #ElasticSearch Service is available - $iready = 1; - } - - return $iready; -} - sub are_you_sure { my ( $self, $msg ) = @_; my $iconfirmed = 0; @@ -437,46 +269,6 @@ This Role provides the following methods =over 4 -=item C - -This method uses the -L|https://metacpan.org/pod/Search::Elasticsearch::Client::2_0::Direct#ping()> -method to verify the service availabilty and wait for C seconds. -When the service does not become available within C seconds it re-throws the -Exception from the C and sets B to C< 112 >. -The C generates a C<"Search::Elasticsearch::Error::NoNodes"> Exception. -When the service is available it will populate the C C structure with the basic information -about the cluster. - -B It will throw an exceptions when the I service does not become available -within C seconds (as described above). - -See L