Original from: http://www.oschina.net/translate/elasticsearch-getting-started? CMP
Tutorial example
We will deploy a very simple application-employees in a department-so that we can focus on functionality rather than complexity. All in all, this blog post aims to help people get started with elasticsearch.
1) Open your cygwin window and type the command
Curl-xput 'HTTP: // localhost: 9200/DEPT/employee/32'-d' {"empname": "emp32 "}'
DEPT is an index and the index type is an employee. At this time, we are entering the 31st IDs of this index type.
You should be able to see this information in the cygwin window:
Let's take a look at the output:
========================================================== ===================================% Total % received % xferd average speed time Current dload upload total spent left speed100 91 100 70 100 21 448 134 --: --: -- 500 {"OK": True, "_ Index": "Dept", "_ type": "employee ", "_ id": "31", "_ version ": 1} =================================================== ========================================
Like the above command -- Let's 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 should remember to add the index counter and the empname value in braces.
Once all this work is done-you input enough data for elasticsearch, you can start to use the head plug-in to search for your data.
Let's try it!
Enter:
Http: // localhost: 9200/_ plugin/head/
You will see this:
Here is an overview of cluster usage and different index information. The recently created index is displayed as "Dept ".
Click nowStructured QueryTab
Select "Dept" from the search menu and click "Search.
This displays all records.
Search for specific entries
Let's search for emp1, emp25, and emp7. Click "+" on the rightmost side to add more search items, as shown in. Then click "Search ". Make sure that the leftmost option is "shocould". Other options should also be consistent with those in the figure.
Now you can continue to try this plug-in. You can use it in your search project.
You can try this application on my desktop:
Http: // 98.228.230.117: 9200/_ plugin/head/
If you have any questions or comments, contact me.
I hope this article will help you quickly get started with "elasticsearch"-a good enterprise-level open-source search product.