Skip to content

[NEST] GetMapping does not work like the _mapping API #1066

@pickypg

Description

@pickypg

GetMapping is currently limited to having knowledge of the index and type in advance, which somewhat defeats the purpose of requesting the mapping in some dynamic cases.

From the documentation:

var mapping = this.ConnectedClient.GetMapping<ElasticSearchProject>();

This returns an IGetMappingResponse based on the request using details extracted from ElasticSearchProject, but it only handles the first index and type (if it managed to return more than one).

However, the _mapping REST API allows you to request the mapping for an optional list of indices and an optional list of types.

# All index mappings with all types
GET /_mapping
# Same as above
GET /_all/_mapping
# Prefix matches with all types
GET /logstash-*/_mapping
# Only the same as above, but only the logs and [made up] "special-logs" types
GET /logstash-*/_mapping/logs,special-logs
# Only indices that contain the specified type(s)
GET /_mapping/type

Each of those are valid requests, but the current NEST GetMapping request would at best handle the first index and its type, thus dropping information.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions