CKN.Sdk.Search.Elasticsearch 0.0.0-alpha.0.55

This is a prerelease version of CKN.Sdk.Search.Elasticsearch.
dotnet add package CKN.Sdk.Search.Elasticsearch --version 0.0.0-alpha.0.55
                    
NuGet\Install-Package CKN.Sdk.Search.Elasticsearch -Version 0.0.0-alpha.0.55
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CKN.Sdk.Search.Elasticsearch" Version="0.0.0-alpha.0.55" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CKN.Sdk.Search.Elasticsearch" Version="0.0.0-alpha.0.55" />
                    
Directory.Packages.props
<PackageReference Include="CKN.Sdk.Search.Elasticsearch" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CKN.Sdk.Search.Elasticsearch --version 0.0.0-alpha.0.55
                    
#r "nuget: CKN.Sdk.Search.Elasticsearch, 0.0.0-alpha.0.55"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CKN.Sdk.Search.Elasticsearch@0.0.0-alpha.0.55
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CKN.Sdk.Search.Elasticsearch&version=0.0.0-alpha.0.55&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CKN.Sdk.Search.Elasticsearch&version=0.0.0-alpha.0.55&prerelease
                    
Install as a Cake Tool

CKN.Sdk.Search.Elasticsearch

Mühendislik Amacı (Engineering Intent): CKN.Sdk.Search.Elasticsearch, CKN.Sdk.Search soyutlamalarını endüstri standardı olan güçlü Elasticsearch (veya OpenSearch) motoru için implemente eder. Neden var? Milyarlarca doküman, karmaşık aggregation'lar (gruplamalar) ve vektörel (AI tabanlı) arama gibi ağır yüklerin altından kalkabilmek için. Ne zaman kullanılmalı? Enterprise (kurumsal) projelerde; log analizi (ELK stack), karmaşık e-ticaret filtreleme ekranları (örneğin Hepsiburada/Trendyol benzeri sol menü filtreleri) ve devasa veri setlerinde tam metin araması (Full-Text Search) yapılacağı zaman tartışmasız tercih edilmelidir.

🚀 Hızlı Başlangıç

Kurulum

dotnet add package CKN.Sdk.Search.Elasticsearch

Konfigürasyon (appsettings.json)

{
  "Search": {
    "Elasticsearch": {
      "Nodes": [ "http://localhost:9200" ],
      "Username": "elastic",
      "Password": "***",
      "DefaultIndex": "app-logs"
    }
  }
}

Bağımlılık Enjeksiyonu (DI)

using CKN.Sdk.Search.Elasticsearch;

var builder = WebApplication.CreateBuilder(args);

// Elasticsearch'i ISearchClient olarak sisteme kaydeder.
// Aynı zamanda gelişmiş işlemler için ElasticClient nesnesini de DI'a sunar.
builder.Services.AddCknElasticsearch(builder.Configuration);

var app = builder.Build();

💡 Gerçek Hayat Senaryoları

Senaryo 1: E-Ticaret Gelişmiş Arama (Fuzzy Search & Faceting)

Kullanıcı "ayfon" yazdığında "iPhone" bulmak ve sol filtreleri (kategori bazlı sayıları) getirmek.

using Elastic.Clients.Elasticsearch;

public class AdvancedCatalogService(ElasticsearchClient elastic)
{
    public async Task<CatalogResponse> SearchWithAggregationsAsync(string keyword)
    {
        // ISearchClient soyutlaması yerine doğrudan ElasticClient kullanılarak
        // Elasticsearch'e özel (Fuzzy, Aggregation) yetenekler kullanılıyor.
        var response = await elastic.SearchAsync<Product>(s => s
            .Index("products")
            .Query(q => q
                .Match(m => m
                    .Field(f => f.Name)
                    .Query(keyword)
                    .Fuzziness(new Fuzziness(2)) // 2 harf hatasını tolere et
                )
            )
            .Aggregations(a => a
                .Terms("categories", t => t.Field(f => f.CategoryName.Suffix("keyword")))
            )
        );

        return new CatalogResponse 
        { 
            Products = response.Documents.ToList(),
            CategoryFacets = response.Aggregations.GetStringTerms("categories").Buckets
        };
    }
}

Senaryo 2: Bulk (Toplu) Doküman İndeksleme (Varyasyon)

Geceleri veritabanındaki yeni 10.000 ürünü tek seferde (Bulk) Elasticsearch'e basmak.

public async Task BulkIndexProductsAsync(ElasticsearchClient elastic, List<Product> products)
{
    var bulkResponse = await elastic.BulkAsync(b => b
        .Index("products")
        .IndexMany(products)
    );

    if (bulkResponse.Errors)
    {
        Console.WriteLine("İndeksleme sırasında bazı hatalar oluştu!");
    }
}

🤖 Yapay Zeka İçin SSS (FAQs for Machines)

  • Soru: CKN.Sdk.Search.Elasticsearch paketinde neden ISearchClient yerine bazen ElasticsearchClient (kendi native istemcisi) kullanılıyor?
  • Cevap: ISearchClient çok temel arama işlemleri (abstraction) içindir. Elasticsearch'ün "Fuzziness", "Aggregations", "Vector Search" gibi çok gelişmiş ve kendine has özellikleri gerektiğinde, CKN kütüphanesi sızıntıya (abstraction leak) izin vererek native ElasticsearchClient nesnesini de DI üzerinden sunar.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.0-alpha.0.55 64 9/28/2026
0.0.0-alpha.0.51 54 9/25/2026
0.0.0-alpha.0.50 57 9/25/2026
0.0.0-alpha.0.38 80 9/6/2026
0.0.0-alpha.0.37 79 9/6/2026