Please format your code using </>
icon as explained in this guide and not the citation button. It will make your post more readable.
Or use markdown style like:
```
CODE
```
This is the icon to use if you are not using markdown format:
It looks like you're using NEST 7.x, based on the create index API call. I can't replicate what you're seeing with NEST 7.0.0-alpha2
private static void Main()
{
var defaultIndex = "example_index";
var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var settings = new ConnectionSettings(pool)
.DefaultIndex(defaultIndex);
var client = new ElasticClient(settings);
var createIndexResponse = client.CreateIndex("honadona", c => c
.Map<ElasticSearchModel>(mm => mm
.AutoMap()
)
);
}
public class ElasticSearchModel
{
public GeoLocation Location { get; set; }
public int Id { get; set; }
public string BuildTitle { get; set; }
public DateTime CreatedDate { get; set; }
public int TotalRooms { get; set; }
public string Description { get; set; }
public decimal? OwnerPrice { get; set; }
public double? Size { get; set; }
public string SizeName { get; set; }
public string MoneyType { get; set; }
public string BuildAction { get; set; }
}
produces the following request
PUT http://localhost:9200/honadona?pretty=true
{
"mappings": {
"properties": {
"location": {
"type": "geo_point"
},
"id": {
"type": "integer"
},
"buildTitle": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"createdDate": {
"type": "date"
},
"totalRooms": {
"type": "integer"
},
"description": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"ownerPrice": {
"type": "double"
},
"size": {
"type": "double"
},
"sizeName": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"moneyType": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"buildAction": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
}
}
}
}
where location
is geo_point
. In your case, it sounds like the index may have already been created before this API call was made, possibly as a result of indexing a document before the explicit mapping for location
was created. In this case, a mapping cannot be updated to be changed from one field datatype to another.
To resolve, you would need to delete the index and create it again, using a create index API call like above.