Elastic Search Phonetic issue with NEST in Dotnet (C#)


(DaCoder) #1

I am new in Elastic search and i want to use it for Phonetic search so I have added plugin NEST in dotnet (C#) using nougat package and also installed phonetic analysis plugin then tried to create index with phonetic but getting following error.

ServerError = {ServerError: 400Type: illegal_argument_exception Reason: "Unknown filter type [phonetic] for [my_metaphone]"}

Code :

var result = client.CreateIndex("indexName", i => i
.Settings(s => s
.Analysis(a => a
.Analyzers(x => x.Custom("my_analyzer", ca => ca.Filters("standard", "lowercase", "my_metaphone")))
.TokenFilters(x => x.Phonetic("my_metaphone", pf => pf.Encoder(PhoneticEncoder.DoubleMetaphone)))
))
.Mappings(m => m
.Map(mm => mm
.AutoMap()
.Properties(p => p
.Text(t => t
.Name(n => n.Name)
.Analyzer("my_analyzer")
.SearchAnalyzer("my_analyzer")
)
)
)
)
);

Can any one help me to create index with phonetic configuration in dotnet?
I am able to create index with below json request.

Code :

PUT /indexname

{
"settings": {
"index": {
"number_of_shards" : 4,
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"filter": ["standard","lowercase","my_metaphone"]
}
},
"filter": {
"my_metaphone": {
"type": "phonetic",
"encoder": "metaphone",
"replace": false
}
}
}
}
},
"mappings":{
"crm3":{
"properties":{
"@timestamp":{
"type":"date"
},
"@version":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"AccountCategory":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"CityName":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"ContactNumbers":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"EmailIDs":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"FirstName":{
"type":"text",
"analyzer": "my_analyzer",
"search_analyzer": "my_analyzer",
"fields":{
"keyword":{
"type":"text"
}
}
},
"Gender":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"IMSINumber":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"IsBlackListed":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"LastName":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"MiddleName":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"OrganizationName":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"Segment":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"SubscriberID":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"SubscriberNo":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"SubscriberTypeName":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
},
"path":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword",
"ignore_above":256
}
}
}
}
}
}
}

Using C# LINQ scenario, it's not working, Can any one guide for the same?
Thanks in Advance,


(system) #2

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