Upversion artifacts to 1.8.0-SNAPSHOT
[aai/search-data-service.git] / README.md
1 # Search Data Service Micro Service
2
3 ## Overview
4 The _Search Data Service_ acts as an abstraction layer for clients which have a need to interact with data which is most suitably persisted in a searchable document store.  The purpose of imposing an abstraction service between the client and the document store itself is to decouple clients from any direct knowledge of any specific document store technology, allowing the underlying technology to be swapped out without a direct impact to any clients which interact with search data.
5
6 Please refer to the following sub-sections for more detailed information:
7
8 [High Level Concepts](./CONCEPTS.md) - Discussion of the high level concepts and building blocks of the _Search Data Service_.
9
10 [Index API](./INDEXES.md) - Details regarding manipulating document indexes.
11
12 [Document API](./DOCUMENTS.md) - Details regarding manipulating documents.
13
14 [Search API](./SEARCH.md) - Details regarding querying the data set.
15
16 [Bulk API](./BULK.md) - Details regarding submitted bulk operation requests.
17
18
19 ## Getting Started
20
21 ### Building The Micro Service
22
23 After cloning the project, execute the following Maven command from the project's top level directory to build the project:
24
25     > mvn clean install
26
27 Now, you can build your Docker image:
28
29     > docker build -t openecomp/search-data-service target 
30     
31 ### Deploying The Micro Service 
32
33 Push the Docker image that you have built to your Docker repository and pull it down to the location that you will be running the search service from.
34
35 Note that the current version of the _Search Data Service_ uses _ElasticSearch_ as its document store back end.  You must therefore deploy an instance of ElasticSearch and make it accessible to the _Search Data Service_.
36
37 **Create the following directories on the host machine:**
38
39     /logs
40     /opt/app/search-data-service/appconfig
41     
42 You will be mounting these as data volumes when you start the Docker container.
43
44 **Populate these directories as follows:**
45
46 ##### Contents of /opt/app/search-data-service/appconfig
47
48 The following files must be present in this directory on the host machine:
49
50 _analysis-config.json_
51 Create this file with exactly the contents below:
52
53
54     [
55         {
56                 "name": "whitespace_analyzer",
57                 "description": "A standard whitespace analyzer.",
58                 "behaviours": [
59                         "Tokenize the text using white space characters as delimeters.",
60                         "Convert all characters to lower case.",
61                         "Convert all alphanumeric and symbolic Unicode characters above the first 127 ASCII characters into their ASCII equivalents."
62                 ],
63                 "tokenizer": "whitespace",
64                 "filters": [
65                         "lowercase",
66                         "asciifolding"
67                 ]
68         },
69         {
70                 "name": "ngram_analyzer",
71                 "description": "An analyzer which performs ngram filtering on the data stream.",
72                 "behaviours": [
73                         "Tokenize the text using white space characters as delimeters.",
74                         "Convert all characters to lower case.",
75                         "Convert all alphanumeric and symbolic Unicode characters above the first 127 ASCII characters into their ASCII equivalents.",
76                         "Apply ngram filtering using the following values for minimum and maximum size in codepoints of a single n-gram: minimum = 1, maximum = 2."
77                 ],
78                 "tokenizer": "whitespace",
79                 "filters": [
80                         "lowercase",
81                         "asciifolding",
82                         "ngram_filter"
83                 ]
84         }
85     ]
86
87 _filter-config.json:_
88
89 Create this file with exactly the contents below:
90
91     [
92         {
93                 "name": "ngram_filter",
94                 "description": "Custom NGram Filter.",
95                 "configuration": " \"type\": \"nGram\", \"min_gram\": 1, \"max_gram\": 50, \"token_chars\": [ \"letter\", \"digit\", \"punctuation\", \"symbol\" ]"
96         }
97     ]
98     
99 _elastic-search.properties_
100
101 This file tells the _Search Data Service_ how to communicate with the ElasticSearch data store which it will use for its back end.
102 The contents of this file will be determined by your ElasticSearch deployment:
103
104     es-cluster-name=<<name of your ElasticSearch cluster>>
105     es-ip-address=<<ip address of your ElasticSearch instance>>
106     ex.http-port=9200
107     
108
109
110 ##### Contents of the /opt/app/search-data-service/app-config/auth Directory
111
112 The following files must be present in this directory on the host machine:
113
114 _search\_policy.json_
115
116 Create a policy file defining the roles and users that will be allowed to access the _Search Data Service_.  This is a JSON format file which will look something like the following example:
117
118     {
119         "roles": [
120             {
121                 "name": "admin",
122                 "functions": [
123                     {
124                         "name": "search", "methods": [ { "name": "GET" },{ "name": "DELETE" }, { "name": "PUT" }, { "name": "POST" } ]
125                     }
126                 ],
127                 "users": [
128                     {
129                         "username": "CN=searchadmin, OU=My Organization Unit, O=, L=Sometown, ST=SomeProvince, C=CA"
130                     }    
131                 ]
132             }
133         ]
134     }
135
136 _tomcat\_keystore_
137
138 Create a keystore with this name containing whatever CA certificates that you want your instance of the _Search Data Service_ to accept for HTTPS traffic.
139
140 **Start the service:**
141
142 You can now start the Docker container for the _Search Data Service_, in the following manner:
143
144         docker run -d \
145             -p 9509:9509 \
146                 -e CONFIG_HOME=/opt/app/search-data-service/config/ \
147                 -e KEY_STORE_PASSWORD={{obfuscated password}} \
148                 -e KEY_MANAGER_PASSWORD=OBF:{{obfuscated password}} \
149             -v /logs:/opt/aai/logroot/AAI-SDB \
150             -v /opt/app/search-data-service/appconfig:/opt/app/search-data-service/config \
151             --name search-data-service \
152             {{your docker repo}}/search-data-service
153     
154 Where,
155
156     {{your docker repo}} = The Docker repository you have published your Search Data Service image to.
157     {{obfuscated password}} = The password for your key store/key manager after running it through the Jetty obfuscation tool.
158
159  
160  
161