Getting Started
Wuha is a search framework that lets you build powerful search engines simply and quickly.
Setting up your Environment
The fastest way to see Wuha in action is with a local ElasticSearch cluster and a Wuha instance running next to it. This is easy to do with Docker. If you're not familiar with Docker, you can learn more about it here.
We're going to run 2 Docker containers: ElasticSearch and Wuha. First, to make sure that these 2 containers can talk to each other, we're going to create a Docker network.
Next, run a local ElasticSearch cluster with the following Docker command:
This ElasticSearch image is managed by Wuha, and is based on the official ElasticSearch image. We've added our ElasticSearch plugin and configured the cluster specifically to be ran as a single node local cluster. In production, this image is not necessary as you'll have your own cluster running.
We also configured ElasticSearch to expose port 9200 on your local machine so you can see what's going on, and to connect to the Docker network so Wuha can talk to the cluster.
You'll need to wait until ElasticSearch has correctly started before continuing. When you can access http://localhost:9200 correctly, that means ElasticSearch is running.
Once ElasticSearch is running correctly, open a new terminal window and run the Wuha application:
Both ElasticSearch and Wuha should now be running correctly, you can test it by accessing the Wuha application at http://localhost:8200
Creating your first Index
Like ElasticSearch, you store information in Wuha in an index (or in several indices). An index has 2 properties:
A name, which you use to identify what you're storing.
A Wuha schema, which defines the format of data being stored.
Let's jump straight in. Assuming you have Wuha running (see our Getting Started guide), open up the Wuha interface (typically http://localhost:8200). Create your index by giving it a name (all lowercase, no spaces) and selecting a schema. We're going to call our index my_demo
and use the demo
schema (which comes built-in with Wuha).
Once you've created your index, you'll see it appear in the table below.
And that's it! The index is created and you're ready to start storing data.
Storing Data
Here's an example document that we want to index. Our index has been created with the built-in demo
schema, so we need to make sure our document is correctly formatted to that schema.
and the equivalent cURL:
Searching
Now that we've stored a document, we can search for it. This quickest way to search is by using the Wuha interface. Open up http://localhost:8200 again go to the search page.
Next Steps
Now you've seen how Wuha works from beginning to end, it's time to dig a bit deeper into the different subjects.
Indices & SchemasSearchingIntroduction to StoringLast updated