ElasticSearch: Найдется все... и быстро!

3,242 views

Published on

По материалам конференции .NET разработчиков - http://dotnetconf.ru/materialy/elasticsearch

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,242
On SlideShare
0
From Embeds
0
Number of Embeds
793
Actions
Shares
0
Downloads
17
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

ElasticSearch: Найдется все... и быстро!

  1. 1. ElasticSearch. … ! www.infinnity.ru 8- .NET т омнр dotnetconf.ru
  2. 2. 2ElasticSearch. … и • “Infinnity Solutions” • – • – Э
  3. 3. 3ElasticSearch. … и ы
  4. 4. 4ElasticSearch. … и • хмм з смм • •
  5. 5. 5ElasticSearch. … и - • • и
  6. 6. 6ElasticSearch. … и • и к ы •
  7. 7. 7ElasticSearch. … и • • ф нм •
  8. 8. 8ElasticSearch. … и Elasticsearch is a flexible and powerful open source, distributed, real-time search and analytics engine www.elasticsearch.org
  9. 9. 9ElasticSearch. … и
  10. 10. 10ElasticSearch. … и ElasticSearch? • • Mongo, Cassandra, Solr • Open-Source
  11. 11. 11ElasticSearch. … и ElasticSearch • и • RESTful • JSON • • • • и • •
  12. 12. 12ElasticSearch. … и • http://ruilopes.com/elasticsearch-setup/ - windows installer • https://github.com/mobz/elasticsearch-head • UI • (JS + REST) • http://www.elastichq.org !
  13. 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. 14. 14ElasticSearch. … и REST • Order: POST http://localhost:9200/order/ • ц • POST http://localhost:9200/order/book/ BODY: { "Author": "E.Evans", "Name": "Domain driven design" }
  15. 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
  16. 16. 16ElasticSearch. … и • JSON • д е и • д е д еи • д и и е
  17. 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. 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
  19. 19. 19ElasticSearch. … и • • д е 19
  20. 20. 20ElasticSearch. … и Cluster (Replica Factor = 1) Search Balancer Node MasterNode Data Node Replica 1Shard 1 Shard 2 Search Balancer Node Data Node Replica 2 DataNode Replica 3 Shard 3 Shard 4 Shard 4 Shard 5 ...
  21. 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. 22. 22ElasticSearch. … и Solr vs ElasticSearch http://blog.socialcast.com/realtime-search-solr-vs-elasticsearch/
  23. 23. 23ElasticSearch. … и .NET • ElasticSearch.NET & NEST • PlainElastic https://github.com/elasticsearch/elasticsearch-net NEST: • и и ElasticSearch • Fluent- и • • и • и и
  24. 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, " ")));
  25. 25. 25ElasticSearch. … и м
  26. 26. 26ElasticSearch. … и 1. дDefault Timeout = 1 s) 2. ElasticSearch
  27. 27. 27ElasticSearch. … и 1. client.Refresh() д е 2. Analyzers & Tokenizers
  28. 28. 28ElasticSearch. … и Analyzer Snowball Analyzer – еал о а о для о я ыко , то ч ле у к . Input Data Term1 Term 2 Term 3
  29. 29. 29ElasticSearch. … и • Standard Analyzer – client.CreateIndex(IndexObject, c => c.AddMapping<Person>( m => m.MapFromAttributes().IndexAnalyzer("string_lowercase")));
  30. 30. 30ElasticSearch. … и ц «…elasticsearchconfigelasticsearch.yml» ц index: analysis: analyzer: string_lowercase: tokenizer: keyword filter: lowercase
  31. 31. 31ElasticSearch. … и Hint • Nest • н щ с щ с • н щ н и щ с • нмм щ смм щ смм к ElasticSearch
  32. 32. 32ElasticSearch. … и ! • н щ н д е • н
  33. 33. 33ElasticSearch. … и • ц • • • • - ES
  34. 34. 34ElasticSearch. … и • • д е • • RESTлJSON • • ElasticSearch – …
  35. 35. 35ElasticSearch. … и www.infinnity.ru

×