Search Tool Elasticsearch – Startup Instructions

Machine Learning Technology Artificial Intelligence Technology Semantic Web Technology Search Technology Web Technology DataBase Technology Ontology Technology Algorithm Workflow & Services Digital Transformation Technology User Interface and DataVisualization Natural Language Processing Technology Navigation of this blog
Search Tool Elasticsearch – Startup Instructions

Since I gave an overview of Elasticsearch in the previous article, I will now describe its actual use. (ES and Kibana version 6.8.13 will be used in the following description.) Starting up Elasticsearch itself is simple. As in the case of FESS described above, install Java, download the zip file from the download page, and from the top of the unzipped folder Then, from the top of the unzipped folder, simply execute “bin/elasticsearch” using the command line tool. After executing the file, launch a browser and execute “localhost:9200”. If you see a json file like the following, you can confirm that elastcisearch is up and running.

{
  "name" : "2rIe_dZ",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "ALXr6XQ-R3OCMCZP-iRAdw",
  "version" : {
    "number" : "6.8.13",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "be13c69",
    "build_date" : "2020-10-16T09:09:46.555371Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.3",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

Next, we will use Kibana to check Elasticsearch data and as a simple data import tool. kibana can also be started by downloading the zip file from the download page and executing “bin/kibana” on the command line from the top of the unzipped folder. You can start it by executing “bin/kibana” on the command line from the top of the unzipped folder. After executing the command, open a browser and enter “localhost:5601” to see if the kibana top page appears. If you click “Discover” in the side menu, you can see the data stored in elasticsearch (you can also see the connection between elasticsearch and kibana).

To use elastcisearch as a search application, we need to add a search UI. elastcisearch has several available modules such as SearchUI and ReactiveSearch as search UI. In this section, we will introduce how to set up a search system using Reactivesearch.

Reactivesearch is a search UI using React, and it uses Reactjs and Vue.js components (MaterialUI, etc.) to connect to Elasticsearch. It is a framework that allows you to easily build a search UI.

As for the data to be introduced into elasticsearch, if it is a simple validation, the results can be retrieved as CSV, and the query can be constructed simply (= no need to prepare a special search UI), leading to speedy validation. In order to satisfy complex requirements, JSON files can be used as input, but the query will be complicated and it will take time to build the UI.

In Elasticsearch, index (database) is created when a Document (search data) is registered, and Mapping (in RDB, Mapping is a table schema) defines how the Index is registered. The data types that define this mapping information include simple types such as string, date, long, double, boolean, and ip, object and nested types for JSON-like structures, and special types such as geo_point, geo_shape, and There are also special types such as geo_point, geo_shape, and completion. These Mappings are automatically defined in Elasticsearch when the data is introduced. (In case of full-text search of documents, etc., they are almost always defined in strings.) Once these Mappings are created, they cannot be updated, so data that should not be created automatically (such as Date data) must be specified when indexing the data.

Based on the above, I will introduce a simple method to actually introduce CSV data.

(1) Start up Elasticsearch and Kibana. (See above)

(2) Select “Machine Learning” from the menu on the left side of the Kibana screen. Select “Import Data (update file),” select the CSV file you want to input from “Select or drag and drop a file,” and the information of the CSV file you input, such as File contetns, Summary, File Stat, etc., will be displayed.

(3) Click the “import” button on the right side of the bottom of the screen, and select “simple” or “advanced” under “Import data”. Mapping Data will be displayed. Select “Advanced” to specify the mapping data in advance, and the Mapping Data will be displayed. Rewrite the mapping data you want to change (for example, change the type of the Date data whose type is keyword to date). In the “Index name” box, enter the index name (used in the UI). After you have done the above, the “Import” button will become available, and when you press the button, the index data will begin to be generated automatically.

(4) After the data generation is completed, select “Discover” from the menu on the left side, and the generated index data will be displayed. (Finish setting up the Elasticsearch part)

The next step is to configure the search UI. This time we will use Reactivesearch, which is built on React, so we need to install npm (a package manager and repository for node.js). You can install npm by downloading the installer from the node website (both windows and mac), or for mac, you can use homebrew.

Once npm is installed, create a node application template in a folder of your choice.

(On the command line, type “npx create-react-app my-app” ;my-app is the name of the app you want to create)

Install the reactivesearch module in the generated node app template (specify the generated folder (my-app) as the top folder in the command line and type “npm install @appbaseio/reactivesearch”). In the generated folder, “node_module folder”, “package.json”, “src folder”, “public folder”, etc. will be generated. If you run “npm start” at this point, the React screen will be launched on your browser’s localhost:3000.

In the next article, we will discuss how to build the actual UI using reactivesearch.

コメント

タイトルとURLをコピーしました