-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Search/SearchSearch-related issues that do not fall into other categoriesSearch-related issues that do not fall into other categories>feature
Description
Problem
Function queries against unmapped fields doesn't work. Adding support for it would be very useful.
Example
We're running a top-level bool query with two should blocks, hitting two indices. Each should block is tailored to one index. This is restricted using filters. However, it will fail due to missing fields despite these filter restrictions.
- Each
should-block target one index, via a filter on_index. This doesn't work, it will still fail with "unknown field [mentioned_at]". - I've also tried setting a filter inside the
functionsblock, with an exists restriction on the field. Doesn't work either.
Env
Version: 6.4.0
More details
This was originally discussed in #8069, and @jpountz asked me to open a new issue about this. Please let me know if I should elaborate on anything.
Full example query
{
"query": {
"bool": {
"should": [{
"bool": {
"should": [{
"function_score": {
"query": {
"multi_match": {
"query": "jane",
"type": "phrase_prefix",
"fields": ["name", "firm"]
}
},
"functions": [{
"filter": {
"exists": {
"field": "mentioned_at"
}
},
"gauss": {
"mentioned_at": {
"origin": "2018-05-07T13:49:33Z",
"scale": "180d",
"offset": "5d",
"decay": 0.5
}
}
}, {
"filter": {
"term": {
"kinsman": true
}
},
"weight": 1.1
}],
"score_mode": "multiply"
}
}],
"filter": {
"bool": {
"must": [{
"term": {
"_index": "attendees"
}
}, {
"term": {
"owner_id": "abc"
}
}]
}
}
}
}, {
"bool": {
"should": [{
"multi_match": {
"query": "jane",
"type": "phrase_prefix",
"fields": ["name", "company"],
"boost": 1.1
}
}],
"filter": {
"bool": {
"must": [{
"term": {
"_index": "users"
}
}, {
"term": {
"company_id": "abc"
}
}, {
"bool": {
"should": [{
"range": {
"archived_at": {
"gte": "2018-02-07T13:49:33Z"
}
}
}, {
"bool": {
"must_not": {
"exists": {
"field": "archived_at"
}
}
}
}]
}
}]
}
}
}
}]
}
}
}Metadata
Metadata
Assignees
Labels
:Search/SearchSearch-related issues that do not fall into other categoriesSearch-related issues that do not fall into other categories>feature