I tried using ``Elastic Workplace Search'' which can collectively search multiple services made free with Elastic Stack 7.9



If you are using multiple services such as Google Drive, Dropbox, and Gmail, you may think that it is a hassle to search 'where did you store that data...?'. ' Workplace Search ' released by

Elastic makes it possible to centralize multiple services and search for information. Since Elastic version 7.9.0 can be used basically free of charge, I actually tried setting up and searching.

Elastic Workplace Search | Elastic
https://www.elastic.co/jp/workplace-search

Workplace Search is provided as part of Elastic Search 's Enterprise Search service. Docker image is prepared for Enterprise Search, so I decided to try Workplace Search using Docker this time. Install Docker by referring to the Docker installation page. First, create a Docker network in order to perform name resolution for inter-container communication by container name.

[code]docker network create elastic-network[/code]



Since Enterprise Search uses Elasticsearch of the time series database for the backend, start the Elasticsearch container in advance. To use Workplace Search, it is necessary to enable the security function by specifying '-e xpack.security.enabled=true' and '-e xpack.security.authc.api_key.enabled=true' in the options.

[code]docker run -it -d -p 9200:9200 -p 9300:9300 --network elastic-network --name elasticsearch \
-e discovery.type=single-node \
-e xpack.security.enabled=true \
-e xpack.security.authc.api_key.enabled=true \
docker.elastic.co/elasticsearch/elasticsearch:7.9.0[/code]



After starting the container, change the password of the Elasticsearch default user with the following command.

[code]docker exec -it elasticsearch /usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive[/code]



Since there are multiple default users, set a password for each.



Next, a random number is used to generate the encryption key required for Workplace Search settings. When executed, a character string such as 'e2cf0f128f730c3343fc137e0cc06f3677d20e170c06a91146f448e9b97fe0cf' is generated.

[code]openssl rand -hex 32[/code]



Start the Enterprise Search container while specifying environment variables. For the 'changeme' part, enter the password of the 'elastic' user you set earlier.

[code]docker run -p 3002:3002 --name workplace-search --network elastic-network \
-e elasticsearch.host='http://elastic:changeme@elasticsearch:9200' \
-e ent_search.auth.source=standard \
-e elasticsearch.username=elastic \
-e elasticsearch.password=changeme \
-e allow_es_settings_modification=true \
-e secret_management.encryption_keys='[e2cf0f128f730c3343fc137e0cc06f3677d20e170c06a91146f448e9b97fe0cf]' \
docker.elastic.co/enterprise-search/enterprise-search:7.9.0[/code]



After the connection to Elasticsearch is completed, the database initialization will start.



Make a note of the username and password that you use to log in to Enterprise Search on the screen after the database initialization is complete.



After completing the initialization process of Enterprise Search, access 'http://localhost:3002'. The welcome screen is displayed. Click 'Continue to Login'.



The login screen is displayed.



Enter the user name and password you wrote down earlier, and click 'Log In'.



Click 'Launch Workplace Search'...



The home screen of Workplace Search is displayed.



Click 'Add sources' to add a search target immediately.



A list of services compatible with the search is displayed. You can

integrate with services such as Gmail, Google Drive, Dropbox, GitHub, Confluence , Jira .



First, let's add 'Gmail' as a search source.



Click 'Configure Gmail'.



It is necessary to set

OAuth authentication with Gmail. Set up according to ' Documentation '.



First, access the Google Developer Console. If the login screen is displayed, log in.

APIs & Services-APIs & Services-Google API Console

https://console.developers.google.com/

Click the button displaying the organization name/project name on the dashboard.



Click 'New Project'.



Enter an easy-to-understand project name and click 'Create'.



Click 'Gmail API' that appears when you type 'gmail' in the search window at the top.



Click Enable.



When the page moves, click 'Create authentication information'.



Select 'Gmail API' in 'API to use', 'Web browser (JavaScript)' in 'Location to call API', 'User data' in 'Type of data to access', and click 'Required authentication information'. ..



You will be prompted to set the OAuth consent screen, so click 'Set consent screen'.



Move to setting screen of consent screen. Set 'User Type' to 'Internal' and click 'Create'. If you use a normal Google account instead of a G Suite account, you can only set 'external'.



A screen for specifying detailed options is displayed. Of these, the 'application name' and 'scope' that need to be set. The application name can be anything that is easy to understand. Click Add Scope.



Check '../auth/gmail.readonly' and click 'Add'.



Click Save at the bottom of the page.



Click 'Create Authentication Information' from 'Authentication Information'.



From the pull-down menu that appears, select 'OAuth Client ID'.



Enter 'Web application' for 'Application type' and a descriptive name for 'Name'.



Click Add URL and specify the URL for Workplace Search.



For the 'approved redirect URI', specify a URI that includes the subdirectories '/ws/org/sources/gmail/create' and '/ws/sources/gmail/create' of the URL of Workplace Search.



Click “Create”……



OAuth client ID and secret key are generated.



Enter the generated ID and key in the Workplace Search screen and click 'Save Configuration'.



If authentication is successful, 'Gmail Configured' will be displayed. Click 'Configure a new source'.



Gmail has been added to 'Configured Sources'.



I thought that 'I should be able to search the contents of Gmail with this', I tried returning to the home screen, but the number of search sources remains zero.



Click 'Setting' to confirm that the settings are correct.



Click 'Content Source Connectors'.



When checking the connection status of each search source, Gmail is a private source, and the private source requires a 'Platinum' license. Unfortunately, the search for Gmail was charged.



If you take your mind again and add Google Drive as a search source in the same way as Gmail, the 'Connect' button turns green and you can click it.



When you click it, a button to connect to Google Drive will be displayed, so click 'Connect Google Drive'.



Since it moves to the Google authentication page, click 'Allow'.



You can now search the contents of Google Drive. Check if you can get the information of Google Drive in 'Details'.



The number of files and so on are displayed, confirming that the connection was successful.



In order to realize cross-searching between Google Drive and Dropbox, I tried to connect with Dropbox by referring to

the connection method with Dropbox.



Click 'Go to search application' to actually search.



The top of the search page shows a list of recently updated files.



Try typing 'text' in the search window...



I was able to search across text files such as PDF with Google Drive and Dropbox.



On the left side, the number of hits for each service for the search, the number of hits for each file type and extension are displayed.



Click the searched item to display the item details on the right side.



By clicking the 'Open on service name' at the bottom, you can check the original data on the service of the search source.



Workplace Search is basically free, but it turns out that Gmail can only be used if you purchase a Platinum license. Although OAuth restricts access authority to improve security, it is a little complicated to set up, but it seems that people who use multiple services can use it conveniently.

in Review,   Software,   Web Service,   Web Application, Posted by darkhorse_log