Skip to content

Commit

Permalink
add 01-keyword-querying-filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
NikiforovAll committed Oct 20, 2024
1 parent 0d17e7d commit 4fd19db
Show file tree
Hide file tree
Showing 4 changed files with 1,479 additions and 36 deletions.
23 changes: 1 addition & 22 deletions src/_infra/azure-infra.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,7 @@
"kernelName": "pwsh"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\n",
" \"environmentName\": \"AzureCloud\",\n",
" \"homeTenantId\": \"b41b72d0-4e9f-4c26-8a69-f949f367c91d\",\n",
" \"id\": \"0b252e02-9c7a-4d73-8fbc-633c5d111ebc\",\n",
" \"isDefault\": true,\n",
" \"managedByTenants\": [],\n",
" \"name\": \"Visual Studio Professional Subscription\",\n",
" \"state\": \"Enabled\",\n",
" \"tenantId\": \"b41b72d0-4e9f-4c26-8a69-f949f367c91d\",\n",
" \"user\": {\n",
" \"name\": \"Oleksii_Nikiforov@epam.com\",\n",
" \"type\": \"user\"\n",
" }\n",
"}\n"
]
}
],
"outputs": [],
"source": [
"az account show\n",
"\n",
Expand Down
35 changes: 21 additions & 14 deletions src/elasticsearch-getting-started/00-quick-start.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Install packages and import modules\n"
"### Install packages and import modules"
]
},
{
Expand All @@ -38,7 +38,7 @@
},
"outputs": [],
"source": [
"#r \"nuget: Elastic.Clients.Elasticsearch\"\n",
"#r \"nuget: Elastic.Clients.Elasticsearch, 8.15.10\"\n",
"#r \"nuget: System.Net.Http.Json, 8.0.1\"\n",
"\n",
"#!import ./Utils.cs\n",
Expand All @@ -51,7 +51,7 @@
"source": [
"## Initialize the Elasticsearch client\n",
"\n",
"Now, we need to initialize the Elasticsearch client. We will use the [Elasticsearch client for .NET](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index.html) to connect to Elasticsearch.\n"
"Now, we need to initialize the Elasticsearch client. We will use the [Elasticsearch client for .NET](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index.html) to connect to Elasticsearch."
]
},
{
Expand Down Expand Up @@ -254,22 +254,22 @@
"using Elastic.Clients.Elasticsearch.IndexManagement;\n",
"using Elastic.Clients.Elasticsearch.Mapping;\n",
"\n",
"\n",
"var indexDescriptor = new CreateIndexRequestDescriptor<Book>(\"book_index\")\n",
" .Mappings(m => m\n",
"var indexResponse = await client.Indices.CreateAsync<Book>(\"book_index\", d =>\n",
" d.Mappings(m => m\n",
" .Properties(pp => pp\n",
" .Text(p => p.Title)\n",
" .DenseVector(\n",
" Infer.Property<Book>(p => p.TitleVector),\n",
" d => d.Dims(textEmeddingDimension).Index(true).Similarity(DenseVectorSimilarity.Cosine))\n",
" .DenseVector(Infer.Property<Book>(p => p.TitleVector),\n",
" d => d\n",
" .Dims(textEmeddingDimension)\n",
" .Index(true)\n",
" .Similarity(DenseVectorSimilarity.Cosine))\n",
" .Text(p => p.Summary)\n",
" .Date(p => p.publish_date)\n",
" .IntegerNumber(p => p.num_reviews)\n",
" .Keyword(p => p.Publisher)\n",
" .Keyword(p => p.Authors)\n",
" )\n",
" );\n",
"\n",
"var indexResponse = await client.Indices.CreateAsync<Book>(indexDescriptor);\n",
" ));\n",
"\n",
"DumpRequest(indexResponse);"
]
Expand Down Expand Up @@ -384,7 +384,7 @@
" .IndexMany<Book>(books, (bd, b) => bd.Index(\"book_index\"))\n",
");\n",
"\n",
"// bulkResponse.Display();"
"bulkResponse.Display();"
]
},
{
Expand Down Expand Up @@ -485,7 +485,14 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [],
"source": [
"var searchQuery = \"javascript books\";\n",
Expand Down
Loading

0 comments on commit 4fd19db

Please sign in to comment.