Skip to content

Commit cc8163d

Browse files
committed
[Docs] Update Analyze section
1 parent b7ab138 commit cc8163d

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

docs/contents/nest/indices/analyze.markdown

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,26 @@ menuitem: analyze
99

1010
Performs the analysis process on the specified text and returns the token breakdown for the text.
1111

12-
## Analyze using default index's default analyzer
12+
## Examples
1313

14-
var text = "this is a string with some spaces and stuff";
15-
var r = this.ConnectedClient.Analyze(text);
14+
### Fluent Syntax
1615

16+
var result = client.Analyze(a => a
17+
.Index("myindex")
18+
.Analyzer("whitespace")
19+
.Text("text to analyze")
20+
);
1721

18-
## Analyze using a fields analyzer
19-
20-
var text = "this is a string with some spaces and stuff";
21-
var r = this.ConnectedClient.Analyze<ElasticSearchProject>(p => p.Content, text);
22-
23-
24-
## Analyze using parameters
25-
26-
var analyzer = new AnalyzeParams { Analyzer = "whitespace", Index = Test.Default.DefaultIndex + "_clone" };
27-
var r = this.ConnectedClient.Analyze(analyzer, text);
22+
### Object Initializer Syntax
2823

24+
var request = new AnalyzeRequest("text to analyze")
25+
{
26+
Index = "myindex",
27+
Analyzer = "whitespace"
28+
};
2929

30+
var result = client.Analyze(request);
3031

32+
## Handling the Analyze response
3133

34+
`result` above is an `IAnalyzeResponse` which contains a collection of tokens found in the `Tokens` property which is an `IEnumerable<AnalyzeToken>`.

0 commit comments

Comments
 (0)