Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field caps api incorrect reports a doc values only scaled float field as not searchable #97394

Closed
martijnvg opened this issue Jul 5, 2023 · 5 comments
Assignees
Labels
>bug :Search Foundations/Mapping Index mappings, including merging and defining field types :StorageEngine/TSDB You know, for Metrics Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch

Comments

@martijnvg
Copy link
Member

Reproduction:

PUT /index1
{
    "settings": {
        "index.mode": "time_series",
        "time_series": {
                "start_time": "2000-01-01T00:00:00Z",
                "end_time": "2099-12-31T23:59:59Z"
            },
            "routing_path": [
                "field1"
            ]
    },
    "mappings": {
        "properties": {
            "field1": {
                "type": "keyword",
                "time_series_dimension": true
            },
            "field2": {
                "type": "long",
                "time_series_metric": "gauge"
            },
            "field3": {
                "type": "scaled_float",
                "time_series_metric": "gauge",
                "scaling_factor": 100
            }
        }
    }
}

GET /index1/_field_caps/?fields=field*

Field caps response:

{
    "indices": [
        "index1"
    ],
    "fields": {
        "field1": {
            "keyword": {
                "type": "keyword",
                "metadata_field": false,
                "searchable": true,
                "aggregatable": true,
                "time_series_dimension": true
            }
        },
        "field3": {
            "scaled_float": {
                "type": "scaled_float",
                "metadata_field": false,
                "searchable": false,
                "aggregatable": true,
                "time_series_metric": "gauge"
            }
        },
        "field2": {
            "long": {
                "type": "long",
                "metadata_field": false,
                "searchable": true,
                "aggregatable": true,
                "time_series_metric": "gauge"
            }
        }
    }
}

Both fields aren't indexed by default (because marked as time series metric), but do have doc values.
Which means the fields are searchable, but slow. However for the scaled float field, field caps reports that it isn't searchable. Which isn't correct. Field caps should report that field3 is searchable.

Looking at the mapping code the ScaledFloatFieldType extends from MappedFieldType and that returns searchable only for indexed fields. Either MappedFieldType should overwrite the isSearchable() method or extend from NumberFieldType.

@martijnvg martijnvg added >bug :Search Foundations/Mapping Index mappings, including merging and defining field types :StorageEngine/TSDB You know, for Metrics labels Jul 5, 2023
@elasticsearchmachine elasticsearchmachine added Team:Search Meta label for search team Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Jul 5, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@lalit-satapathy
Copy link

Is this fixed as part of 8.10?

@martijnvg
Copy link
Member Author

Yes, that is fixed in 8.10. The PR got merged before the 8.10 branch was cut.

@martijnvg
Copy link
Member Author

Fixed via #97724

@javanna javanna added Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch and removed Team:Search Meta label for search team labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search Foundations/Mapping Index mappings, including merging and defining field types :StorageEngine/TSDB You know, for Metrics Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch
Projects
None yet
Development

No branches or pull requests

5 participants