Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/search/request/suggest-usage.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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<Question>(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

Expand Down