# Getting Started

## 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.](https://docs.docker.com/install)

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.

```
docker network create wuha
```

Next, run a local ElasticSearch cluster with the following Docker command:

```
docker run --rm -it -p "9200:9200" --network="wuha" --network-alias="elasticsearch" wuhaio/elasticsearch
```

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:

```
docker run --rm -it -p "8200:8200" -p "8201:8201" --network="wuha" wuhaio/wuha
```

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:

1. A name, which you use to identify what you're storing.
2. 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).

![](https://1449072638-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXs40nPRHcXGqfPFkdO%2F-LaUeUEYa1zWjWrW7QXX%2F-LaUnu0NbAW4Ztc9S2x8%2FScreenshot%202019-03-21%20at%2011.32.42.png?alt=media\&token=62ccf7b3-c088-40d0-9b8e-5e2d152f9db8)

Once you've created your index, you'll see it appear in the table below.

![](https://1449072638-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXs40nPRHcXGqfPFkdO%2F-LaUeUEYa1zWjWrW7QXX%2F-LaUo9ntn4fZ9VWlFVvj%2FScreenshot%202019-03-21%20at%2011.33.54.png?alt=media\&token=735d7ec9-483e-4b75-b858-1510bbc05e27)

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.

```
POST http://localhost:8201/index/wuha_demo_my_demo
{
  "title": "Business Plan February 2018",
  "contents": "Our business plan for February 2018 is to grow from $10K MRR to $15k MRR. We will do this by doubling our client base."
}
```

and the equivalent cURL:

```
curl \
  -X POST \
  --header "Content-Type: application/json" \
  --data '{ "title": "Business Plan February 2019", "contents": "Our business plan for February 2018 is to grow from $10K MRR to $15k MRR. We will do this by doubling our client base." }' \
  http://localhost:8201/index/wuha_demo_my_demo
```

## 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.

![](https://1449072638-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXs40nPRHcXGqfPFkdO%2F-LaUeUEYa1zWjWrW7QXX%2F-LaUphvXJUTkPjMG8DaN%2FScreenshot%202019-03-21%20at%2011.36.40.png?alt=media\&token=67ba191f-ccbf-4881-873f-b3c6584fc2bb)

## 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.

{% content-ref url="concepts/creating-an-index" %}
[creating-an-index](https://wuha.gitbook.io/api/concepts/creating-an-index)
{% endcontent-ref %}

{% content-ref url="concepts/searching" %}
[searching](https://wuha.gitbook.io/api/concepts/searching)
{% endcontent-ref %}

{% content-ref url="indexing-your-data-1/indexing-your-data" %}
[indexing-your-data](https://wuha.gitbook.io/api/indexing-your-data-1/indexing-your-data)
{% endcontent-ref %}
