diff --git a/ElasticSearch/AuthorsMappings.json b/ElasticSearch/Authors.json similarity index 60% rename from ElasticSearch/AuthorsMappings.json rename to ElasticSearch/Authors.json index 15ba2b0a..74718f31 100644 --- a/ElasticSearch/AuthorsMappings.json +++ b/ElasticSearch/Authors.json @@ -1,4 +1,14 @@ { + "settings": { + "analysis": { + "analyzer": { + "default": { + "tokenizer": "icu_tokenizer", + "filter": [ "lowercase", "icu_folding" ] + } + } + } + }, "author" : { "properties" : { "authorNames" : { diff --git a/ElasticSearch/AuthorsSettings.json b/ElasticSearch/AuthorsSettings.json deleted file mode 100644 index bc3182f0..00000000 --- a/ElasticSearch/AuthorsSettings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "settings": { - "analysis": { - "analyzer": { - "default": { - "tokenizer": "icu_tokenizer", - "filter": [ "lowercase", "icu_folding" ] - } - } - } - } -} \ No newline at end of file diff --git a/ElasticSearch/BuildESIndex.sh b/ElasticSearch/BuildESIndex.sh index 8e87e766..c12be496 100644 --- a/ElasticSearch/BuildESIndex.sh +++ b/ElasticSearch/BuildESIndex.sh @@ -2,34 +2,26 @@ sServer=$1 sIndex=$2 -sDocType=$3 -sSettings=$4 -sMappings=$5 +sSettings=$3 -if [ $# -eq 5 ] +if [ $# -eq 3 ] then echo echo Building index $sServer/$sIndex with settings in $sSettings curl -X PUT $sServer/$sIndex -d @$sSettings --header "Content-Type:application/json" echo - echo - echo Adding mappings for $sServer/$sIndex/_mapping/$sDocType with mappings in $sMappings - curl -X POST $sServer/$sIndex/_mapping/$sDocType -d @$sMappings --header "Content-Type:application/json" - echo echo Done else echo echo Usage echo - echo BuildESIndex SERVER-NAME INDEX-NAME DOC-TYPE SETTINGS-FILENAME MAPPINGS-FILENAME + echo BuildESIndex SERVER-NAME INDEX-NAME SETTINGS-FILENAME echo echo SERVER-NAME is the name of the search server, including the port number echo INDEX-NAME is the name of the index to be created - echo DOC-TYPE is the type of documents to be added to the index - echo SETTINGS-FILENAME is the name of a file containing index settings - echo MAPPINGS-FILENAME is the name of a file containing index mappings + echo SETTINGS-FILENAME is the name of a file containing index settings and mappings echo - echo Example: BuildESIndex http://localhost:9200 items item ItemsSettings.json ItemsMappings.json + echo Example: BuildESIndex http://localhost:9200 items Items.json echo fi echo diff --git a/ElasticSearch/Catalog.json b/ElasticSearch/Catalog.json new file mode 100644 index 00000000..8d1f1166 --- /dev/null +++ b/ElasticSearch/Catalog.json @@ -0,0 +1,239 @@ +{ + "settings": { + "analysis": { + "analyzer": { + "default": { + "tokenizer": "icu_tokenizer", + "filter": [ "lowercase", "icu_folding" ] + } + } + } + }, + "mappings" : { + "catalogitem" : { + "properties" : { + "associations" : { + "type" : "text", + "analyzer" : "default" + }, + "authors" : { + "type" : "keyword", + "index" : false + }, + "collections" : { + "type" : "keyword", + "include_in_all" : false + }, + "container" : { + "type" : "text", + "analyzer" : "default", + "fields" : { + "raw" : { + "type" : "keyword" + } + } + }, + "contributors" : { + "type" : "text", + "analyzer" : "default", + "fields" : { + "raw" : { + "type" : "keyword" + } + }, + "include_in_all" : false + }, + "dateRanges" : { + "type" : "keyword", + "include_in_all" : false + }, + "dates" : { + "type" : "keyword" + }, + "doi" : { + "type" : "text", + "analyzer" : "standard", + "fields" : { + "raw" : { + "type" : "keyword" + } + } + }, + "facetAuthors" : { + "type" : "keyword", + "index" : false + }, + "genre" : { + "type" : "keyword", + "include_in_all" : false + }, + "id" : { + "type" : "keyword", + "include_in_all" : false + }, + "isbn" : { + "type" : "text", + "analyzer" : "standard", + "fields" : { + "raw" : { + "type" : "keyword" + } + } + }, + "issn" : { + "type" : "text", + "analyzer" : "standard", + "fields" : { + "raw" : { + "type" : "keyword" + } + } + }, + "issue" : { + "type" : "text", + "analyzer" : "default" + }, + "itemId" : { + "type" : "long", + "include_in_all" : false + }, + "keywords" : { + "type" : "text", + "analyzer" : "default", + "fields" : { + "raw" : { + "type" : "keyword" + } + } + }, + "language" : { + "type" : "keyword", + "include_in_all" : false + }, + "materialType" : { + "type" : "keyword", + "include_in_all" : false + }, + "oclc" : { + "type" : "text", + "analyzer" : "standard", + "fields" : { + "raw" : { + "type" : "keyword" + } + } + }, + "pageRange" : { + "type" : "keyword", + "index" : false + }, + "publicationPlace" : { + "type" : "text", + "analyzer" : "default", + "fields" : { + "raw" : { + "type" : "keyword" + } + }, + "include_in_all" : false + }, + "publisher" : { + "type" : "text", + "analyzer" : "default", + "fields" : { + "raw" : { + "type" : "keyword" + } + }, + "include_in_all" : false + }, + "searchAuthors" : { + "type" : "text", + "analyzer" : "default" + }, + "segmentId" : { + "type" : "long", + "include_in_all" : false + }, + "series" : { + "type" : "text", + "analyzer" : "default" + }, + "sortTitle" : { + "type" : "keyword", + "include_in_all" : false + }, + "startPageId" : { + "type" : "long", + "include_in_all" : false + }, + "title" : { + "type" : "text", + "analyzer" : "default", + "fields" : { + "raw" : { + "type" : "keyword" + } + } + }, + "titleId" : { + "type" : "long", + "include_in_all" : false + }, + "translatedTitle" : { + "type" : "text", + "analyzer" : "default" + }, + "uniformTitle" : { + "type" : "text", + "analyzer" : "default" + }, + "url" : { + "type" : "keyword", + "index" : false + }, + "variants" : { + "type" : "text", + "analyzer" : "default" + }, + "volume" : { + "type" : "text", + "analyzer" : "default" + }, + "volumes": { + "type": "nested", + "properties": { + "id" : { + "type" : "keyword", + "include_in_all" : false + }, + "itemId" : { + "type" : "long", + "include_in_all" : false + }, + "volume" : { + "type" : "text", + "analyzer" : "default" + }, + "date" : { + "type" : "keyword", + "include_in_all" : false + }, + "hasExternalContent" : { + "type" : "boolean" + }, + "hasIllustrations" : { + "type" : "boolean" + }, + "hasLocalContent" : { + "type" : "boolean" + }, + "hasSegments" : { + "type" : "boolean" + } + } + } + } + } + } +} diff --git a/ElasticSearch/ItemsMappings.json b/ElasticSearch/Items.json similarity index 95% rename from ElasticSearch/ItemsMappings.json rename to ElasticSearch/Items.json index 002feee8..762cc51e 100644 --- a/ElasticSearch/ItemsMappings.json +++ b/ElasticSearch/Items.json @@ -1,4 +1,14 @@ { + "settings": { + "analysis": { + "analyzer": { + "default": { + "tokenizer": "icu_tokenizer", + "filter": [ "lowercase", "icu_folding" ] + } + } + } + }, "item" : { "properties" : { "associations" : { diff --git a/ElasticSearch/ItemsSettings.json b/ElasticSearch/ItemsSettings.json deleted file mode 100644 index bc3182f0..00000000 --- a/ElasticSearch/ItemsSettings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "settings": { - "analysis": { - "analyzer": { - "default": { - "tokenizer": "icu_tokenizer", - "filter": [ "lowercase", "icu_folding" ] - } - } - } - } -} \ No newline at end of file diff --git a/ElasticSearch/KeywordsMappings.json b/ElasticSearch/Keywords.json similarity index 60% rename from ElasticSearch/KeywordsMappings.json rename to ElasticSearch/Keywords.json index a4c2cdc1..70ba2651 100644 --- a/ElasticSearch/KeywordsMappings.json +++ b/ElasticSearch/Keywords.json @@ -1,4 +1,14 @@ { + "settings": { + "analysis": { + "analyzer": { + "default": { + "tokenizer": "icu_tokenizer", + "filter": [ "lowercase", "icu_folding" ] + } + } + } + }, "keyword" : { "properties" : { "id" : { diff --git a/ElasticSearch/KeywordsSettings.json b/ElasticSearch/KeywordsSettings.json deleted file mode 100644 index bc3182f0..00000000 --- a/ElasticSearch/KeywordsSettings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "settings": { - "analysis": { - "analyzer": { - "default": { - "tokenizer": "icu_tokenizer", - "filter": [ "lowercase", "icu_folding" ] - } - } - } - } -} \ No newline at end of file diff --git a/ElasticSearch/NamesMappings.json b/ElasticSearch/Names.json similarity index 65% rename from ElasticSearch/NamesMappings.json rename to ElasticSearch/Names.json index 2b700c2a..98fce035 100644 --- a/ElasticSearch/NamesMappings.json +++ b/ElasticSearch/Names.json @@ -1,4 +1,14 @@ { + "settings": { + "analysis": { + "analyzer": { + "default": { + "tokenizer": "icu_tokenizer", + "filter": [ "lowercase", "icu_folding" ] + } + } + } + }, "name" : { "properties" : { "count" : { diff --git a/ElasticSearch/NamesSettings.json b/ElasticSearch/NamesSettings.json deleted file mode 100644 index bc3182f0..00000000 --- a/ElasticSearch/NamesSettings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "settings": { - "analysis": { - "analyzer": { - "default": { - "tokenizer": "icu_tokenizer", - "filter": [ "lowercase", "icu_folding" ] - } - } - } - } -} \ No newline at end of file diff --git a/ElasticSearch/PagesMappings.json b/ElasticSearch/Pages.json similarity index 82% rename from ElasticSearch/PagesMappings.json rename to ElasticSearch/Pages.json index e574be0e..75a81993 100644 --- a/ElasticSearch/PagesMappings.json +++ b/ElasticSearch/Pages.json @@ -1,4 +1,14 @@ { + "settings": { + "analysis": { + "analyzer": { + "default": { + "tokenizer": "icu_tokenizer", + "filter": [ "lowercase", "icu_folding" ] + } + } + } + }, "page" : { "properties" : { "id" : { diff --git a/ElasticSearch/PagesSettings.json b/ElasticSearch/PagesSettings.json deleted file mode 100644 index bc3182f0..00000000 --- a/ElasticSearch/PagesSettings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "settings": { - "analysis": { - "analyzer": { - "default": { - "tokenizer": "icu_tokenizer", - "filter": [ "lowercase", "icu_folding" ] - } - } - } - } -} \ No newline at end of file diff --git a/ElasticSearch/README.md b/ElasticSearch/README.md index 3efce236..f0f7507a 100644 --- a/ElasticSearch/README.md +++ b/ElasticSearch/README.md @@ -25,15 +25,17 @@ Windows command prompt 4) Run the following commands to build the indexes. - curl -X PUT SERVER/items -d @ItemsSettings.json --header "Content-Type:application/json" + curl -X PUT SERVER/catalog -d @Catalog.json --header "Content-Type:application/json" - curl -X PUT SERVER/pages -d @PagesSettings.json --header "Content-Type:application/json" + curl -X PUT SERVER/items -d @Items.json --header "Content-Type:application/json" + + curl -X PUT SERVER/pages -d @Pages.json --header "Content-Type:application/json" - curl -X PUT SERVER/authors -d @AuthorsSettings.json --header "Content-Type:application/json" + curl -X PUT SERVER/authors -d @Authors.json --header "Content-Type:application/json" - curl -X PUT SERVER/keywords -d @KeywordsSettings.json --header "Content-Type:application/json" + curl -X PUT SERVER/keywords -d @Keywords.json --header "Content-Type:application/json" - curl -X PUT SERVER/names -d @NamesSettings.json --header "Content-Type:application/json" + curl -X PUT SERVER/names -d @Names.json --header "Content-Type:application/json" where @@ -41,43 +43,18 @@ Windows command prompt Example: - curl -X PUT http://localhost:9200/items -d @ItemsSettings.json --header "Content-Type:application/json" - - curl -X PUT http://localhost:9200/pages -d @PagesSettings.json --header "Content-Type:application/json" - - curl -X PUT http://localhost:9200/authors -d @AuthorsSettings.json --header "Content-Type:application/json" - - curl -X PUT http://localhost:9200/keywords -d @KeywordsSettings.json --header "Content-Type:application/json" - - curl -X PUT http://localhost:9200/names -d @NamesSettings.json --header "Content-Type:application/json" + curl -X PUT http://localhost:9200/catalog -d @Catalog.json --header "Content-Type:application/json" -5) Run the following commands to add the mappings to the indexes. + curl -X PUT http://localhost:9200/items -d @Items.json --header "Content-Type:application/json" - curl -X POST SERVER/items/\_mapping/item -d @ItemsMappings.json --header "Content-Type:application/json" - - curl -X POST SERVER/pages/\_mapping/page -d @PagesMappings.json --header "Content-Type:application/json" + curl -X PUT http://localhost:9200/pages -d @Pages.json --header "Content-Type:application/json" - curl -X POST SERVER/authors/\_mapping/author -d @AuthorsMappings.json --header "Content-Type:application/json" + curl -X PUT http://localhost:9200/authors -d @Authors.json --header "Content-Type:application/json" - curl -X POST SERVER/keywords/\_mapping/keyword -d @KeywordsMappings.json --header "Content-Type:application/json" + curl -X PUT http://localhost:9200/keywords -d @Keywords.json --header "Content-Type:application/json" - curl -X POST SERVER/names/\_mapping/name -d @NamesMappings.json --header "Content-Type:application/json" - - where - - SERVER is the address of the search server, including the port number + curl -X PUT http://localhost:9200/names -d @Names.json --header "Content-Type:application/json" - Example: - - curl -X POST http://localhost:9200/items/\_mapping/item -d @ItemsMappings.json --header "Content-Type:application/json" - - curl -X POST http://localhost:9200/pages/\_mapping/page -d @PagesMappings.json --header "Content-Type:application/json" - - curl -X POST http://localhost:9200/authors/\_mapping/author -d @AuthorsMappings.json --header "Content-Type:application/json" - - curl -X POST http://localhost:9200/keywords/\_mapping/keyword -d @KeywordsMappings.json --header "Content-Type:application/json" - - curl -X POST http://localhost:9200/names/\_mapping/name -d @NamesMappings.json --header "Content-Type:application/json" Bash shell @@ -89,15 +66,17 @@ Bash shell 3) Run the following commands to build the indexes. - bash BuildESIndex.sh SERVER items item ItemsSettings.json ItemsMappings.json + bash BuildESIndex.sh SERVER catalog Catalog.json - bash BuildESIndex.sh SERVER pages page ItemsSettings.json ItemsMappings.json + bash BuildESIndex.sh SERVER items Items.json + + bash BuildESIndex.sh SERVER pages Pages.json - bash BuildESIndex.sh SERVER authors author ItemsSettings.json ItemsMappings.json + bash BuildESIndex.sh SERVER authors Authors.json - bash BuildESIndex.sh SERVER keywords keyword ItemsSettings.json ItemsMappings.json + bash BuildESIndex.sh SERVER keywords Keywords.json - bash BuildESIndex.sh SERVER names name ItemsSettings.json ItemsMappings.json + bash BuildESIndex.sh SERVER names Names.json where @@ -105,12 +84,14 @@ Bash shell Example: - bash BuildESIndex.sh http://localhost:9200 items item ItemsSettings.json ItemsMappings.json + bash BuildESIndex.sh http://localhost:9200 catalog Catalog.json + + bash BuildESIndex.sh http://localhost:9200 items Items.json - bash BuildESIndex.sh http://localhost:9200 pages page PagesSettings.json PagesMappings.json + bash BuildESIndex.sh http://localhost:9200 pages Pages.json - bash BuildESIndex.sh http://localhost:9200 authors author AuthorsSettings.json AuthorsMappings.json + bash BuildESIndex.sh http://localhost:9200 authors Authors.json - bash BuildESIndex.sh http://localhost:9200 keywords keyword KeywordsSettings.json KeywordsMappings.json + bash BuildESIndex.sh http://localhost:9200 keywords Keywords.json - bash BuildESIndex.sh http://localhost:9200 names name NamesSettings.json NamesMappings.json + bash BuildESIndex.sh http://localhost:9200 names Names.json