Description
Describe the bug
In wildcard type fields, the field value is retrieved from DocValues if doc_values
is enabled; otherwise, it falls back to the stored
field. As of the current implementation (refer to WildcardFieldMapper.java#L325), the default value for doc_values
in wildcard fields is false (see 46a0045), which appears to be an unintended error.
For nested fields, sub-documents do not build stored
indexes and lack doc_values
entirely. Consequently, wildcard queries within nested fields will fail to retrieve values from sub-documents.
Related component
Search:Relevance
To Reproduce
PUT wildcard_index1
{
"mappings": {
"properties": {
"outter_filed": {
"type": "nested",
"properties": {
"wildcard1": {
"type": "wildcard"
}
}
}
}
}
}
PUT wildcard_index1/_doc/23
{
"outter_filed": {
"wildcard1": "abcd"
}
}
POST wildcard_index1/_search
{
"query": {
"bool": {
"filter": [
{
"nested": {
"path": "outter_filed",
"query": {
"wildcard": {
"outter_filed.wildcard1": "*bc*"
}
}
}
}
]
}
}
}
And we will return no result.
Expected behavior
- Temporary Mitigation:
Explicitly set doc_values: true when defining wildcard fields to ensure value retrieval from DocValues. This bypasses the default false configuration and enables nested queries to access sub-document values.
- Permanent Fix:
When doc_values
is disabled (false), the nested sub-document field will automatically build a stored
index to retain retrievable values.
Additional Details
brcnch: main
Metadata
Metadata
Assignees
Labels
Type
Projects
Status