This document discusses Elasticsearch and provides an overview of its key features and capabilities. Elasticsearch is described as a flexible, powerful, open source, distributed, real-time search and analytics engine. The document then covers topics like how Elasticsearch is RESTful and uses JSON, its data model of indexes and types, and how it can be used for full text search and analytics capabilities.
12. 12ElasticSearch. … и
• http://ruilopes.com/elasticsearch-setup/ -
windows installer
• https://github.com/mobz/elasticsearch-head
• UI
• (JS + REST)
• http://www.elastichq.org
!
13. 13ElasticSearch. … и
Ша д
И дек ые а лы Lucene (5 а ло )
Index
Type1
Type2
Type3
Index = DataBase
Type = Table
Document = Record
Type1 Json doc
Type2 Json doc
Type2 Json doc
Type 3 Json doc
14. 14ElasticSearch. … и
REST
• Order:
POST http://localhost:9200/order/
• ц
• POST http://localhost:9200/order/book/
BODY:
{
"Author": "E.Evans",
"Name": "Domain driven design"
}
15. 15ElasticSearch. … и
POST http://localhost:9200/order/book/
( http://localhost:9200/order http://localhost:9200/)
BODY :
{
"query":{
"bool":{
"must":[
{
"query_string":{
"default_field":"book.Name",
"query":" driven design"
}
}
]
}
},
"from":0,
"size":50
}
и и
и
REST
17. 17ElasticSearch. … и
• Iу-4770 CPU 3.5GHz
16GB Windows 7 x64
• нммм к
• ц ц и и и
• ц ниои фи
нтипоитр к
• JSON ц
{
Id : 5,
Code : 4E899A40-FA60-4D51-B4F9-BCF9F7FAACEC",
Value : " CC305862-BA2D-409C-A662-3D589EF7011C"
}
•
ElasticSearch
18. ROW COUNT: 1000
THREAD COUNT: 64 (8 CPUs)
TOTAL
Total time: 00:03:39.4040000 (219,40 sec)
Average time: 219,40 ms/operation
Average speed: 4,558 operation/sec
INSERT
Total time: 00:00:54.9130000 (54,91 sec)
Average time: 54,91 ms/operation
Average speed: 18,211 operation/sec
UPDATE
Total time: 00:01:05.4060000 (65,41 sec)
Average time: 65,41 ms/operation
Average speed: 15,289 operation/sec
DELETE
Total time: 00:00:34.2190000 (34,22 sec)
Average time: 34,22 ms/operation
Average speed: 29,224 operation/sec
SELECT
Total time: 00:01:04.8660000 (64,87 sec)
Average time: 64,87 ms/operation
Average speed: 15,416 operation/sec
21. 21ElasticSearch. … и
Production
• – 3
node, 1 replica
• 1 node
• SSD
• GitHub:
• 44 amazon EC2 instance
• 30Tb data
• 8 instances и
• 2 replica
• Stackoverflow.com (StackExchange) :
• 3 ES instance / 1 replica
22. 22ElasticSearch. … и
Solr vs
ElasticSearch
http://blog.socialcast.com/realtime-search-solr-vs-elasticsearch/
23. 23ElasticSearch. … и
.NET
• ElasticSearch.NET & NEST
• PlainElastic
https://github.com/elasticsearch/elasticsearch-net
NEST:
• и
и ElasticSearch
• Fluent- и
•
• и
• и и
24. 24ElasticSearch. … и
1. public class Person
{
public string Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
2. var test = new Person()
{
Id щ “123456",
LastName = " ",
FirstName = " ",
};
3. client.Index(test); // Nest
4. var items = client.Search<Person>(f => f.Filter(ff => ff.Term(i => i.LastName, " ")));
29. 29ElasticSearch. … и
• Standard Analyzer –
client.CreateIndex(IndexObject, c => c.AddMapping<Person>(
m => m.MapFromAttributes().IndexAnalyzer("string_lowercase")));