Skip to content

DefaultMappingFor does not map type to index #8694

@Thornfalt

Description

@Thornfalt

Elastic.Clients.Elasticsearch version: 8.18.3

Elasticsearch version: 8.10.3

.NET runtime version: .NET 9

Operating system version: Windows 11

Description of the problem including expected versus actual behavior:
DefaultMappingFor does not map type to index. I tried using .DefaultIndex as well and it still does not set the index while searching, it searches through all indices.

Steps to reproduce:

  1. Create ElasticsearchClientSettings and set DefaultMappingFor(t => t.IndexName("TestIndex")
  2. Use SearchAsync and create a query.
  3. Check the response and you can see that it hits all indices.

Expected behavior
I expect the type to be mapped to the index, so I only get result from that index.
Since DefaultMappingFor still exists in 8.18.3 I expect it to work.
Calling .DefaultIndex() also does not seem to work.

Provide DebugInformation (if relevant):
Valid Elasticsearch response built from a successful (200) low level call on POST: /_search?pretty=true&error_trace=true&_source_includes...

I can't seem to find definitive information on this. Is this intentional? Is mapping the type to a specific index deprecated? I just want to know if I need to implement my own solution to this or if it's a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions