Problem with the namespace


#1

I've got a project which uses ES2.x currently. And I'm upgrading it to ES5.x. But I got a problem with the namespace. I could not use both NEST 2.0.0 and NEST 5.0.0 at the same time in one project. So I download the source code and change the namespace for NEST 5.x and Elasticsearch.net 5.x to NEST5 and Elasticsearch.NET5. But after when i use the compiled .dll files in the project. It could not do any mapping to the index. And throws out something like the following:
Invalid NEST response built from a unsuccessful low level call on PUT: /reviewsearch_v1# Audit trail of this API call: - [1] BadResponse: Took: 00:00:00.3499997# ServerError: ServerError: 400Type: mapper_parsing_exception Reason: "Failed to parse mapping [reviews]: No handler for type [{name=long}] declared on field [zidReviewId]" CausedBy: "Type: mapper_parsing_exception Reason: "No handler for type [{name=long}] declared on field [zidReviewId]""# OriginalException: System.Net.WebException: The remote server returned an error: (400) Bad Request. at System.Net.HttpWebRequest.GetResponse() at Elasticsearch.Net5.HttpConnection.Request[TReturn](RequestData requestData)#
Any idea will be appreciated. Thanks!


(Mark Walkom) #2

Perhaps if you can show your code it will help us?


#3

Hi warkolm , here is the function I use to create mappings
protected void CreateIndex()
{
var createResponse = Client.CreateIndex("reviewsearch_v1", cis => cis
.Mappings(ms => ms.Map(m => m.AutoMap())));
}
And I tried to get the failed request as below:
{
"mappings":{
"reviews":{
"properties":{
"zidReviewId":{
"type":{
"name":"long"
},
"doc_values":true
},
"chvProductType":{
"type":{
"name":"keyword"
},
"doc_values":true
}
}
}
}
}

Vs the correct request:
{
"mappings":{
"reviews":{
"properties":{
"zidReviewId":{
"type":"long",
"doc_values":true
},
"chvProductType":{
"type":"keyword",
"doc_values":true
}
}
}
}
}
It seems that the failed request put a "name" under "type". Do you have any idea why is that?
Add the document class.
[ElasticsearchType(
Name = "reviews",
IdProperty = "zidReviewId"
)]
public class ReviewSearchDocument
{
[Number(NumberType.Long, DocValues = true)]
public long zidReviewId { get; set; }
[Keyword(DocValues = true)]
public string chvProductType { get; set; }
}


(system) #4

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