Turn: ElasticSearch simple entry

Original link: http://www.cnblogs.com/guoyongrong/p/3862773.html

Original from: http: //www.oschina.net/translate/elasticsearch-getting-started cmp?

Tutorial sample

We are going to deploy a very simple application - employees in a department - so we can focus on function rather than on oxygen Synaptic complexity. All in all, this blog is to help people start ElasticSearch started.

1) Open now your cygwin window and type the command

curl -XPUT 'http://localhost:9200/dept/employee/32' -d '{ "empname": "emp32"}'

dept index and the index is a type of employee, at this time we are entering this type of 31st id.

You should be able to see this information in the cygwin window:

Let's look at the output:

========================================================================
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    91  100    70  100    21    448    134 --:--:-- --:--:-- --:--:--   500{"ok":true,"_index":"dept","_type":"employee","_id":"31","_version":1}
========================================================================

And above command the same - let us enter more records:

curl -XPUT 'http://localhost:9200/dept/employee/1' -d '{ "empname": "emp1"}'
curl -XPUT 'http://localhost:9200/dept/employee/2' -d '{ "empname": "emp2"}'
...
...
curl -XPUT 'http://localhost:9200/dept/employee/30' -d '{ "empname": "emp30"}'

Note: You have to remember the value of the index increased counter and braces empname of.

Once this work is done - you have entered enough data to ElasticSearch, you can start using your head plugin search the data.

Let's try it!

In the browser, enter:

http://localhost:9200/_plugin/head/ 

You will see this:

Here is an overview of the different cluster usage and index information. We recently created an index which is displayed as "dept".

Now click Structured Query tab

Select "dept" In Search down menu and click the "Search" button.

This will display all records.

Search for specific entries

Let's search emp1, emp25 and emp7. Click continue rightmost "+" to add more search terms, just as shown in the display, then click "Search". Ensure the leftmost option "should", other options should be consistent and figure.

Now you can go try this plugin, you can use it to your search project.

You can try the application running on my desktop computer:

http://98.228.230.117:9200/_plugin/head/ 

If you have any questions or comments, please contact me.

I hope this article will allow you to get started quickly "ElasticSearch" - a nice open source enterprise search products.

Reproduced in: https: //www.cnblogs.com/guoyongrong/p/3862773.html

Guess you like

Origin blog.csdn.net/weixin_30633405/article/details/94794174