Skip to content

More Like This Queries should error when Routing Set to "required" and no routing is supplied #29678

@kylelyk

Description

@kylelyk

Elasticsearch version: 6.2.4

Plugins installed: []

JVM version: 1.8.0_101

OS version: MacOS (Darwin Kernel Version 15.6.0)

Description of the problem including expected versus actual behavior:
"More Like This" queries do not return any results when "mappings.type._routing" = true.

Steps to reproduce:

PUT test { "mappings": { "type": { "_routing": { "required": true }, "properties": { "myField": { "type": "text" } } } } } 
POST /_bulk { "index": { "_index": "test", "_type": "type","_id":1, "_routing":1 }} {"myField":"and_foo"} { "index": { "_index": "test", "_type": "type","_id":2, "_routing":2 }} {"myField":"and_foo" } 

The following query returns no results:

GET /_search { "query": { "more_like_this": { "fields": [ "myField" ], "like": [ { "_index": "test", "_type": "type", "_id": "1" } ], "min_term_freq": 1, "min_doc_freq": 1 } } } 

If the _routing setting in the index mapping is removed, it correctly returns 1 result.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions