You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In version 8.17.0 mapping for nested fields are not recognized, the "type": "nested" is missing hence queries fail. But when downgrading back to 8.16.3 everything works as expected
I'm not able to reproduce this. The following example:
varmapping=newTypeMappingDescriptor<X>()// Your code uses a non-generic version here which does not exists!?.Properties(p =>p.Nested(n =>n.Branches, nd =>nd.Properties(np =>np.Keyword(k =>k.Branches.First().Id).Nested(nn =>nn.Branches.First().Services, nnd =>nnd.Properties(nnp =>nnp.LongNumber(k =>k.Branches.First().Services.First().Id).Text(t =>t.Branches.First().Services.First().Name))))));awaitclient.Indices.CreateAsync<X>("new_idx", d =>d.Mappings(mapping));publicclassX{publicY[]Branches{get;set;}=default!;}publicclassY{publicstringId{get;set;}=default!;publicZ[]Services{get;set;}=default!;}publicclassZ{publicstringId{get;set;}=default!;publicstringName{get;set;}=default!;}
In version 8.17.0 mapping for nested fields are not recognized, the "type": "nested" is missing hence queries fail. But when downgrading back to 8.16.3 everything works as expected
Index created in 8.16.3:
{ "test-index": { "aliases": {}, "mappings": { "properties": { "branches": { "type": "nested", "properties": { "id": { "type": "long" }, "services": { "type": "nested", "properties": { "id": { "type": "long" }, "name": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } } } } } } } }, "settings": { "index": { "creation_date": "1705197654049", "number_of_shards": "1", "number_of_replicas": "1", "uuid": "vMprJ3AHSperrvC_sbOvcw", "version": { "created": "7050099" }, "provided_name": "business-index" } } } }
Index created in 8.17.0:
{ "test-index": { "aliases": {}, "mappings": { "properties": { "branches": { "properties": { "id": { "type": "long" }, "services": { "properties": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "id": { "type": "long" }, "name": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, } } } } } }, "settings": { "index": { "routing": { "allocation": { "include": { "_tier_preference": "data_content" } } }, "number_of_shards": "1", "provided_name": "test-index", "creation_date": "1736434041031", "number_of_replicas": "1", "uuid": "5SBIB0pjRpe17hVyiTz0kg", "version": { "created": "8080299" } } } } }
Index Mapping:
`
protected override TypeMappingDescriptor ConfigureMappings(TypeMappingDescriptor descriptor)
{
return descriptor
.Properties(p => p
.Nested(n => n.Branches, nd => nd.Properties(np => np
.Keyword(k => k.Branches.First().Id)
.Nested(nn => nn.Branches.First().Services, nnd => nnd.Properties(nnp => nnp
.LongNumber(k => k.Branches.First().Services.First().Id)
.Text(t => t.Branches.First().Services.First().Name))
)))
);
}
var createResponse = await _client.Indices.CreateAsync(IndexName, descriptor => descriptor
.Mappings(mapping => ConfigureMappings(mapping)));
`
Elastic.Clients.Elasticsearch version: 8.17.0
Elasticsearch version: 8.8.2
.NET runtime version : 8.0.11
The text was updated successfully, but these errors were encountered: