Slide 1

Slide 1 text

1 Steve Gordon (Senior Engineer @ Elastic) @stevejgordon | stevejgordon.co.uk An Introduction to Elasticsearch (for .NET Developers) https://bit.ly/elasticsearch-net-intro

Slide 2

Slide 2 text

We build search solutions on a single stack Enterprise Search Observability Security

Slide 3

Slide 3 text

4 Store, Search, & Analyze Visualize & Manage Ingest Elastic Stack SOLUTIONS Kibana Elasticsearch Beats Logstash SaaS Elastic cloud On-Prem Elastic cloud Enterprise Standalone Elastic cloud On Kubernetes Elastic Agent Serverless Elasticsearch Serverless

Slide 4

Slide 4 text

5

Slide 5

Slide 5 text

6 Demo Elastic Cloud Deployment

Slide 6

Slide 6 text

7 Basic Terminology CLUSTER A collection of one or more nodes (servers) that together hold your data and provide federated indexing and search capabilities across all nodes.

Slide 7

Slide 7 text

8 Basic Terminology CLUSTER A single server that is part of your cluster, stores your data, and participates in the clusters indexing and search capabilities. NODE 1 NODE 2 NODE 3

Slide 8

Slide 8 text

9 Basic Terminology CLUSTER A collection of documents that have somewhat similar characteristics. NODE 1 NODE 2 NODE 3 INDEX

Slide 9

Slide 9 text

10 Basic Terminology CLUSTER Elasticsearch provides the ability to subdivide your index into multiple pieces called shards. NODE 1 NODE 2 NODE 3 INDEX SHARD (PRIMARY) P1 SHARD (PRIMARY) P2 SHARD (PRIMARY) P3 SHARD (REPLICA) R3 SHARD (REPLICA) R1 SHARD (REPLICA) R2

Slide 10

Slide 10 text

11 Basic Terminology CLUSTER Elasticsearch provides the ability to subdivide your index into multiple pieces called shards. NODE 1 NODE 2 NODE 3 INDEX SHARD (PRIMARY) P1 SHARD (PRIMARY) P2 SHARD (PRIMARY) P3 SHARD (REPLICA) R3 SHARD (REPLICA) R1 SHARD (REPLICA) R2

Slide 11

Slide 11 text

12 Basic Terminology CLUSTER The basic unit of information that can be indexed in JSON form. NODE 1 NODE 2 NODE 3 INDEX SHARD (PRIMARY) P1 SHARD (PRIMARY) P2 SHARD (PRIMARY) P3 SHARD (REPLICA) R3 SHARD (REPLICA) R1 SHARD (REPLICA) R2 DOC DOC DOC DOC DOC DOC DOC DOC DOC DOC DOC DOC

Slide 12

Slide 12 text

13 JSON Document { "title": "This is a title for a blog post", "content": "This is the content for a really cool blog post about Elasticsearch", "category": "Elasticsearch", "date": "2023-04-14T09:27:00+0000", "isPublished": true, "upvotes": 512 }

Slide 13

Slide 13 text

14 Field Mapping Dynamic mapping { "title": "This is a title for a blog post", "content": "This is the content for a really cool blog post about Elasticsearch", "category": "Elasticsearch", "date": "2023-04-14T09:27:00+0000", "isPublished": true, "upvotes": 512 } text field with a .keyword sub-field (ignore_above = 256)

Slide 14

Slide 14 text

15 Field Mapping Dynamic mapping { "title": "This is a title for a blog post", "content": "This is the content for a really cool blog post about Elasticsearch", "category": "Elasticsearch", "date": "2023-04-14T09:27:00+0000", "isPublished": true, "upvotes": 512 } date field

Slide 15

Slide 15 text

16 Field Mapping Dynamic mapping { "title": "This is a title for a blog post", "content": "This is the content for a really cool blog post about Elasticsearch", "category": "Elasticsearch", "date": "2023-04-14T09:27:00+0000", "isPublished": true, "upvotes": 512 } boolean field

Slide 16

Slide 16 text

17 Field Mapping Dynamic mapping { "title": "This is a title for a blog post", "content": "This is the content for a really cool blog post about Elasticsearch", "category": "Elasticsearch", "date": "2023-04-14T09:27:00+0000", "isPublished": true, "upvotes": 512 } long field

Slide 17

Slide 17 text

18 Explicit Mapping Field Types Aggregate metric Alias Arrays Binary Boolean Completion Date Date nanoseconds Dense vector Flattened Geopoint Geoshape Histogram IP Join Keyword Nested Numeric Object Percolator Point Range Rank feature Rank features Search-as-you-type Shape Text Token count Unsigned long Version

Slide 18

Slide 18 text

19 19 HTTP Interface

Slide 19

Slide 19 text

20 The Elasticsearch API in numbers • > 420 API endpoints (560 routes) • > 4000 data structures, including: ‒ 52 query types ‒ 79 aggregation types ‒ 35 field types

Slide 20

Slide 20 text

21 Language Clients • .NET • Java • JavaScript • Ruby • Go • PHP • Perl • Python • Rust

Slide 21

Slide 21 text

22 Previous Elasticsearch .NET Client v7 NEST High Level Client Strongly-typed requests, responses and Query DSL. Elasticsearch.Net Low Level Dependency free, unopinionated client. Handles transport and basic requests/responses.

Slide 22

Slide 22 text

23 Problems with the v7 client • Hand written ‒ API is not always consistent ‒ A lot of maintenance work (400 endpoints and thousands of types!) • Legacy internalised JSON serialiser based on Utf8Json • 10 years of historical decisions

Slide 23

Slide 23 text

24 Introducing Elastic.Clients.Elasticsearch • A new generation of the Elasticsearch client • Code Generated ‒ Based on a formal specification of the Elasticsearch API ‒ Most of the code is code-generated using Roslyn APIs • Uses System.Text.Json serializer • Built on a common Elastic.Transport layer • Removes some of the legacy of the past to create a cleaner API The new .NET client for v8.0

Slide 24

Slide 24 text

25 Demo .NET Client

Slide 25

Slide 25 text

26 Resources • https://bit.ly/elasticsearch-net-intro • github.com/elastic/elasticsearch-net • elastic.co/guide/en/elasticsearch/client/net-api/current • nuget.org/packages/NEST • nuget.org/packages/Elastic.Clients.Elasticsearch • github.com/stevejgordon/elasticsearch-examples • discuss.elastic.co

Slide 26

Slide 26 text

27 Thank you! @stevejgordon