How specify kstem in a query

I'm using c# and am building a query similar to what is shown below. I want to use a kstem filter. Anyone know the syntax for that?

public async Task ExecuteAsync()
{
var result = await client.SearchAsync(
s =>
s.Type(typeEmployee)
.Query(q =>
q.MatchPhrase(m =>
m.Field(f => f.About).Query("rock climbing"))
));
Result = result.Documents;
}

You can specify the analyser to use on match type queries but usually you
are better off using the analyzer configured on the field. If you want to
use a different analyzer at index and query time you can use
search_analyzer. Usually you don't, but some analysis techniques call for
it.

I don't know the C# syntax for changing the analyzer on the query though,
sorry!

I did an

I looked into it a bit more and generally the analyzers and filters are defined in the index when the mapping is created as you say, and that's all I need. I'm new to elasticsearch. It would be nice to see a complete mapping statement with a stemmed defined in the index part.

Maybe around here?

Like, I'm wondering where would be a good place to link it.

Thanks. I have enough rope now. :slight_smile:

No, no! I really did mean that I was going to add something to the page and was asking your opinion on where. Something like:

The example above created the mapping that looks like

example here

See the mapping section for how to set up the mapping prior to creating indices.

Or something like that.

Okay. In Lucene.Net you add your documents to an index. When searching you load the index and create an analyzer for the fields you want to search on. The analyzer comes into play when searching the index.

The difference in elasticsearch, it seems to me, is the analyzer goes with the field, defined in a PUT command with the mapping.

On on the Index api page, separate out Indexing a document, which is really saving a document to an index that's already defined.

Then show the mapping PUT statement including indexing commands, like:

PUT crud_sample
{
"mappings": {
"Customer_Info": {
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "text",
"index" : {
"analysis" : {
"analyzer" : {
"my_analyzer" : {
"tokenizer" : "standard",
"filter" : ["standard", "lowercase", "my_stemmer"]
}
},
"filter" : {
"my_stemmer" : {
"type" : "stemmer",
"name" : "light_english"
}
}
}
}
},
"age": {
"type": "integer"
},
"birthday": {
"type": "date",
"format": "basic_date"
},
"hasChildren": {
"type": "boolean"
},
"enrollmentFee": {
"type": "double"
}
}
}
}
}

But it appears that that doesn't work. So, I guess my question is how do I run this:

{
"index" : {
"analysis" : {
"analyzer" : {
"my_analyzer" : {
"tokenizer" : "standard",
"filter" : ["standard", "lowercase", "my_stemmer"]
}
},
"filter" : {
"my_stemmer" : {
"type" : "stemmer",
"name" : "light_german"
}
}
}
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.