In my previous article, “Getting Started with Elastic App Search,” I covered App Search in detail at Elastic Enterprise Search. If you don’t know anything about Elastic App Search, please read that article. I’m going to assume that you’re already familiar with the introduction there.

In today’s article, I’ll show you how to use the Meta Engine provided by App Search to further extend our Search experience.

 

What is Meta Engine?

Elastic has introduced the Meta Engine for Elastic App Search on Elastic Cloud and self-managed versions since release 7.6 and is pleased with the response to the new features. If you missed the 7.6 announcement, check out the enhancements we’ve made to our entire enterprise search solution.

Meta-engines provide the ability to search across multiple existing or new engines. Consider adding a new search box to the page, then close the page and search for documents in the subengine of your choice. This allows large companies (or indeed companies of any size) to unify and extend their search capabilities while still allowing search/webmasters complete control over the behavior of each sub-engine.

Create the Elatic App Search meta-engine

 

Use cases:

For Acme Inc., there are many departments, and each department has its own website, such as Blog, Support, Docs, Products and Commerce. Each has its own App Search Engine. We can create a Meta engine on top of these engines to make it easier for us to Tunning, Boosting and Analytics the entire search experience:

When using Meta Engine, we must be aware of the following:

  • Schema: Schema matching between different engines is very important. For example, if one engine has the title field, it expects the other engines to have the same field and their data type to be the same
  • Autonomy: Any changes to Source Engine will reflect meta Engine. These changes include field changes, field type changes and so on
  • Read-only files: If you want to edit anything, you must do it in source Engine, not meta Engine. Meta Engine does not have any documentation
  • Permissions: Meta Engine can be created only if you have administrative Permissions, or have ownership access
  • Read Rights: Meta Engine users will have Read rights to Source Engine

The installation

App Search is installed slightly differently in Elastic 7.7. In today’s article, I’ll show you how to install it. I’m going to describe it in terms of the Elastic 7.7 release.

Elasticsearch

See my previous article “How to Install Elasticsearch on Linux, MacOS, and Windows” to install Elasticsearch. In the latest release, we need to activate the security mechanism. To do this, we need to fix the config/ elasticSearch. yml file. We add the following configuration:

xpack.security.enabled: true
Copy the code

Here we start Elasticsearch security. Let’s start Elasticsearch. On the other console, type the following command:

./bin/elasticsearch-setup-passwords auto
Copy the code

With the command above, it will generate the password information we need:

Changed password for user apm_system
PASSWORD apm_system = 8E1m7pJwJQ9uHCSfONXk

Changed password for user kibana
PASSWORD kibana = RVDFQDWSHNbPsjZ3qczu

Changed password for user logstash_system
PASSWORD logstash_system = Jrl6FdjF1uzziGNeufng

Changed password for user beats_system
PASSWORD beats_system = EfG4NDFmiASlIxLR00Sa

Changed password for user remote_monitoring_user
PASSWORD remote_monitoring_user = f4HTlKs5rrVvQwTITJin

Changed password for user elastic
PASSWORD elastic = 2P4WzhKTlB5IcL6qIukV
Copy the code

We write down the password produced by the above command for future use.

See “Elasticsearch: Setting Up Elastic Account security” for more information.

Kibana

We can refer to my previous article “How to Install Kibana in an Elastic stack on Linux, MacOS, and Windows” for our installation. Since we just enabled security in Elasticsearch, we have to modify the config/kibana.yml file:

elasticsearch.username: "kibana"
elasticsearch.password: "RVDFQDWSHNbPsjZ3qczu"
Copy the code

Notice the password above. It comes from the password we produced in Elasticsearch above. We launched Kibana. If our configuration is successful, then we should see:

We typed in the password of our previous Elastic user, which allowed us to access the Kibana interface:

In order to implement meta Engine’s functionality, we must use the Start A 30-day trial license:

Enterprise App Search

Let’s install App Search next. We can address www.elastic.co/downloads/e… To download App Search. There are detailed installation instructions on it. Download the installation files for different platforms. We unzip the App Search installation file into a directory. For Mac OS:

Tar XZF enterprise-search-7.7.0.tar.gz CD enterprise-search-7.7.0Copy the code

We have to modify the config/enterprise-search.yml configuration file. According to www.elastic.co/downloads/e. For the above requirements, we make the following configuration:

ent_search.auth.source: standard
elasticsearch.username: elastic
elasticsearch.password: 2P4WzhKTlB5IcL6qIukV
allow_es_settings_modification: true
secret_management.encryption_keys: [4a2cd3f81d39bf28738c10db0ca782095ffac07279561809eecc722e0c20eb09]
Copy the code

Notice the password above. It comes from the password generation section of Elasticsearch above. Then we run it as follows:

./bin/enterprise-search
Copy the code

On our first run, we can see the following screen:

It tells us the username and password. This is what you use to log in to App Search. Then, we can see the following screen:

Here, we can see that App Search has been successfully launched. We also see that it prompts us to add the secret_session_key to the config/enterprise-search.yml file. This preserves the session when App Search is restarted. We modify config/enterprise-search.yml and restart App Search.

Enter http://localhost:3002 in your browser’s address bar:

Click Continue to Login above:

Enter the username and password saved above and click Log In:

So now we’re in App Search.

Import data

In today’s test, we will use the following data:

git clone https://github.com/liu-xiao-guo/elastic-meta-engine-datasets
Copy the code

In the repository above there are two JSON files: eastern-national-parks.json and western-national-parks.json. One of the documents reads as follows:

"description": "Covering most of Mount Desert Island and other coastal islands, Acadia features the tallest mountain on the Atlantic coast of the United States, granite peaks, ocean shoreline, woodlands, and lakes. There are freshwater, estuary, forest, and intertidal habitats.", "nps_link": "https://www.nps.gov/acad/index.htm", "states": ["Maine"], "title": "Acadia", "id": "park_acadia", "visitors": 3303393, "world_heritage_site": false, "location": "44.35,-68.21", "acres": 49057.36, "square_km": 198.5, "date_established" : "the 1919-02-26 T06:00:00 Z"Copy the code

These two documents show some information about national parks in the eastern and western United States. In terms of the result of the data, the fields in the two JSON files are the same.

I click the Launch App Search button above:

Let’s start by creating the East-Parks Engine. Type east-parks and click Continue:

Let’s click Upload a JSON file:

We select the east-national-parks.json file and click Continue:

Click the Close button:

So we created our first East-Parks Engine, which we called the Source Engine.

Next we use the same method to create an engine called West-Parks:

 

So we create two source engines: West-parks and east-parks. By default, all imported data is of type TEXT. We can click on Manage above and modify the two engines accordingly:

For the above data types, I made the following adjustments:

Once we’re done tweaking, we need to click Update Types to complete the change. We could have two more engines that do the same thing.

For a Search of both engines, see my previous article “Getting Started with Elastic App Search.” In today’s article, I’ll focus on how to create a Meta Engine to search for both engines.

 

Create meta engine

Open App Search:

Click on the Meta Engines:

Let’s select both West-parks and East-Parks and click Create Meta Engine:

From the above, we can see that there are a total of 11 documents, which is exactly the amount of east-Parks (4) and West-Parks (7) engine documents combined. Now we can Search against this Meta Engine as we described in our previous article “Getting Started with Elastic App Search.” Only this time, we’re searching both engines in Meta Engine. We search for Florida

We search Utah:

Let’s start by searching for birds:

None of the documents shown above contain birds.

Let’s create a synonym:

 

Click Create a Synonym Set:

Above, we set birds, Falcon, Eagle, and BATS as synonyms. So when we search for birds, all documents containing any of the words birds, Falcon, Eagle, and BATS will be searched. Click Save:

Click the Create a Synomym Set button. This creates a synonym set. Let’s continue with the synonyms:

We can see both west-parks and East-Parks documents displayed above.

See the previous article “Getting Started with Elastic App Search” for additional App Search features.