aboutsummaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-25 18:41:33 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-25 18:41:33 -0800
commitf6f7450903bdbe36bd5fff146b942e34ad221557 (patch)
treec50332c832f414b5c0070e58a42ceb4751ed4d81 /extra
parent16256f8ed119c072c09b13b0b1a6d4a56bed5113 (diff)
downloadfatcat-f6f7450903bdbe36bd5fff146b942e34ad221557.tar.gz
fatcat-f6f7450903bdbe36bd5fff146b942e34ad221557.zip
transform and import fixes/tweaks
Diffstat (limited to 'extra')
-rw-r--r--extra/elasticsearch/README.md16
-rw-r--r--extra/elasticsearch/changelog_schema.json5
-rw-r--r--extra/elasticsearch/fatcat_schema.json109
3 files changed, 122 insertions, 8 deletions
diff --git a/extra/elasticsearch/README.md b/extra/elasticsearch/README.md
index 761ad6ab..691c6ed5 100644
--- a/extra/elasticsearch/README.md
+++ b/extra/elasticsearch/README.md
@@ -38,13 +38,17 @@ There is a Dockerfile in this directory which includes this installation.
Drop and rebuild the schema:
- http delete :9200/fatcat
- http put :9200/fatcat < release_schema.json
+ http delete :9200/fatcat_release
+ http delete :9200/fatcat_container
+ http delete :9200/fatcat_changelog
+ http put :9200/fatcat_release < release_schema.json
+ http put :9200/fatcat_container < container_schema.json
+ http put :9200/fatcat_changelog < changelog_schema.json
Put a single object (good for debugging):
- head -n1 examples.json | http post :9200/fatcat/release/0
- http get :9200/fatcat/release/0
+ head -n1 examples.json | http post :9200/fatcat_release/release/0
+ http get :9200/fatcat_release/release/0
Bulk insert from a file on disk:
@@ -53,14 +57,14 @@ Bulk insert from a file on disk:
Or, in a bulk production live-stream conversion:
export LC_ALL=C.UTF-8
- time zcat /srv/fatcat/snapshots/fatcat_release_dump_expanded.json.gz | ./fatcat_export.py transform-releases - - | esbulk -verbose -size 20000 -id ident -w 8 -index fatcat -type release
+ time zcat /srv/fatcat_release/snapshots/fatcat_release_dump_expanded.json.gz | ./fatcat_export.py transform-releases - - | esbulk -verbose -size 20000 -id ident -w 8 -index fatcat -type release
## Full-Text Querying
A generic full-text "query string" query look like this (replace "blood" with
actual query string, and "size" field with the max results to return):
- GET /fatcat/release/_search
+ GET /fatcat_release/release/_search
{
"query": {
"query_string": {
diff --git a/extra/elasticsearch/changelog_schema.json b/extra/elasticsearch/changelog_schema.json
index 7a7ec90c..f3211e99 100644
--- a/extra/elasticsearch/changelog_schema.json
+++ b/extra/elasticsearch/changelog_schema.json
@@ -16,8 +16,9 @@
"changelog": {
"properties": {
"index": { "type": "integer" },
- "editgorup_id": { "type": "keyword" },
- "timestamp": { "type": "datetime" },
+ "editgroup_id": { "type": "keyword" },
+ "timestamp": { "type": "date" },
+ "editor_id": { "type": "keyword" },
"username": { "type": "keyword" },
"is_bot": { "type": "boolean" },
"is_admin": { "type": "boolean" },
diff --git a/extra/elasticsearch/fatcat_schema.json b/extra/elasticsearch/fatcat_schema.json
new file mode 100644
index 00000000..05583330
--- /dev/null
+++ b/extra/elasticsearch/fatcat_schema.json
@@ -0,0 +1,109 @@
+{
+"settings": {
+ "index": {
+ "analysis": {
+ "analyzer": {
+ "default": {
+ "type": "custom",
+ "tokenizer": "standard",
+ "filter": [ "lowercase", "asciifolding" ]
+ },
+ "textIcu": {
+ "type": "custom",
+ "tokenizer": "icu_tokenizer",
+ "char_filter": [ "icu_normalizer" ],
+ "filter": [ "icu_folding" ]
+ },
+ "textIcuSearch": {
+ "type": "custom",
+ "tokenizer": "icu_tokenizer",
+ "char_filter": [ "icu_normalizer" ],
+ "filter": [ "icu_folding" ]
+ }
+ }
+ }
+ }
+},
+"mappings": {
+ "release": {
+ "properties": {
+ "ident": { "type": "keyword" },
+ "state": { "type": "keyword" },
+ "revision": { "type": "keyword" },
+ "title": { "type": "text", "index": true, "analyzer": "textIcu", "search_analyzer":"textIcuSearch" },
+ "original_title": { "type": "text", "index": true, "analyzer": "textIcu", "search_analyzer":"textIcuSearch" },
+ "release_date": { "type": "date" },
+ "release_year": { "type": "integer" },
+ "release_type": { "type": "keyword" },
+ "release_status": { "type": "keyword" },
+ "language": { "type": "keyword" },
+ "doi": { "type": "keyword" },
+ "pmid": { "type": "keyword" },
+ "pmcid": { "type": "keyword" },
+ "isbn13": { "type": "keyword" },
+ "wikidata_qid": { "type": "keyword" },
+ "core_id": { "type": "keyword" },
+ "axiv_id": { "type": "keyword" },
+ "jstor_id": { "type": "keyword" },
+ "license": { "type": "keyword" },
+ "publisher": { "type": "text", "index": true, "analyzer": "textIcu", "search_analyzer":"textIcuSearch" },
+ "container_name": { "type": "text", "index": true, "analyzer": "textIcu", "search_analyzer":"textIcuSearch" },
+ "container_issnl": { "type": "keyword" },
+ "container_type": { "type": "keyword" },
+ "contrib_count": { "type": "integer" },
+ "contrib_names": { "type": "text", "index": true, "analyzer": "textIcu", "search_analyzer":"textIcuSearch" },
+ "ref_count": { "type": "integer" },
+ "file_count": { "type": "integer" },
+ "fileset_count": { "type": "integer" },
+ "webcapture_count": { "type": "integer" },
+ "any_abstract": { "type": "boolean" },
+
+ "best_pdf_url": { "type": "keyword" },
+ "ia_pdf_url": { "type": "keyword" },
+ "is_oa": { "type": "boolean" },
+ "is_longtail_oa": { "type": "boolean" },
+ "is_preserved": { "type": "boolean" },
+ "in_kbart": { "type": "boolean" },
+ "in_jstor": { "type": "boolean" },
+ "in_dweb": { "type": "boolean" },
+ "in_web": { "type": "boolean" },
+ "in_ia": { "type": "boolean" },
+ "in_ia_sim": { "type": "boolean" },
+ "in_shadows": { "type": "boolean" },
+
+ "author": { "type": "alias", "path": "contrib_names" },
+ "journal": { "type": "alias", "path": "container_name" },
+ "date": { "type": "alias", "path": "release_date" },
+ "year": { "type": "alias", "path": "release_year" },
+ "issn": { "type": "alias", "path": "container_issnl" },
+ "oa": { "type": "alias", "path": "is_oa" },
+ "longtail": { "type": "alias", "path": "is_longtail_oa" },
+ "lang": { "type": "alias", "path": "language" },
+ "file_pdf_url": { "type": "alias", "path": "best_pdf_url" },
+ "is_kept": { "type": "alias", "path": "in_kbart" }
+ }
+ },
+ "changelog": {
+ "properties": {
+ "index": { "type": "integer" },
+ "editgorup_id": { "type": "keyword" },
+ "timestamp": { "type": "date" },
+ "username": { "type": "keyword" },
+ "is_bot": { "type": "boolean" },
+ "is_admin": { "type": "boolean" },
+ "agent": { "type": "keyword" },
+ "containers": { "type": "integer" },
+ "creators": { "type": "integer" },
+ "files": { "type": "integer" },
+ "filessets": { "type": "integer" },
+ "webcaptures": { "type": "integer" },
+ "releases": { "type": "integer" },
+ "works": { "type": "integer" },
+ "created": { "type": "integer" },
+ "updated": { "type": "integer" },
+ "deleted": { "type": "integer" },
+ "total": { "type": "integer" }
+ }
+ }
+}
+}