From f8617cc7dee578441c021fb462001e95b3f658a3 Mon Sep 17 00:00:00 2001 From: George Kinsman Date: Thu, 7 Dec 2017 13:22:48 +1000 Subject: [PATCH] Update suggest-usage.asciidoc --- docs/search/request/suggest-usage.asciidoc | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/search/request/suggest-usage.asciidoc b/docs/search/request/suggest-usage.asciidoc index 0d32fe3cdc4..df5840edeee 100644 --- a/docs/search/request/suggest-usage.asciidoc +++ b/docs/search/request/suggest-usage.asciidoc @@ -21,6 +21,36 @@ The suggest feature suggests similar looking terms based on a provided text by u See the Elasticsearch documentation on {ref_current}/search-suggesters.html[Suggesters] for more detail. +[float] +=== Indexing example + +[source,csharp] +---- +public class Question +{ + public CompletionField TitleSuggest { get; set; } +} + +var createIndexResponse = client.CreateIndex("my_index", c => c + .Mappings(m => m + .Map(u => u + .AutoMap() + ) + ) +); + +var question = new Question +{ + TitleSuggest = new CompletionField + { + Input = new[] { "This is the title" }, + Weight = 5 + } +}; + +client.Index(question, i => i.Index("my_index").Refresh(Refresh.WaitFor)); +---- + [float] === Fluent DSL example