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

Remove support for _type in searches #2986

Closed
dreamer-89 opened this issue Apr 19, 2022 · 4 comments
Closed

Remove support for _type in searches #2986

dreamer-89 opened this issue Apr 19, 2022 · 4 comments
Assignees
Labels
enhancement Enhancement or improvement to existing feature or request Indexing & Search v2.0.0 Version 2.0.0

Comments

@dreamer-89
Copy link
Member

dreamer-89 commented Apr 19, 2022

This issue tracks the removal of _type from all search request related classes (FieldTypeLookUp, TypeFieldType etc). There are few ITs still using _type for terms, sorted terms queries. As part of this issue, need to remove them all.

Verified that _type reference in terms query, ids query throws proper unknown field exception

Sample Request

curl -X PUT localhost:9200/test-index

curl -X POST localhost:9200/test-index/_doc -d '{ 
    "field" : "value"
}'

curl -X POST localhost:9200/test-index/_doc -d '{ 
    "field" : "value2"
}'

curl -XPOST localhost:9200/test-index/_search?pretty -d '{
    "query": {
        "terms": {
            "field": {
                "index": "test-index",
                "id": "lfy6Q4ABr3FIIAx0k9_1",
                "path": "",
                "type": "_doc"
            }
         }
    }
}'

Response

{
    "error": {
        "root_cause": [
            {
                "type": "x_content_parse_exception",
                "reason": "[8:17] [terms_lookup] unknown field [type]"
            }
        ],
        "type": "x_content_parse_exception",
        "reason": "[8:17] [terms_lookup] unknown field [type]"
    },
    "status": 400
}

Related: #2979

@dreamer-89 dreamer-89 added enhancement Enhancement or improvement to existing feature or request untriaged labels Apr 19, 2022
@dreamer-89
Copy link
Member Author

dreamer-89 commented Apr 19, 2022

I see exists query with _type value in field fetches all record. I am not sure if this is a bug and should be fixed in 2.0 release. @nknize @reta @CEHENKLE : WDYT about this ?

Request

curl -XPOST localhost:9200/test-index/_search?pretty -d '
{
    "query": {
        "exists": {
            "field": "_type"
         }
    }
}'

Response

{
    "took": 2,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 4,
            "relation": "eq"
        },
        "max_score": 1.0,
        "hits": [
            {
                "_index": "test-index",
                "_id": "kvyyQ4ABr3FIIAx07N_Z",
                "_score": 1.0,
                "_source": {
                    "field": "value"
                }
            },
            {
                "_index": "test-index",
                "_id": "lfy6Q4ABr3FIIAx0k9_1",
                "_score": 1.0,
                "_source": {
                    "field": "value2"
                }
            }
        ]
    }
}

@reta
Copy link
Collaborator

reta commented Apr 19, 2022

I see exists query with _type value in field fetches all record. I am not sure if this is a bug and should be fixed in 2.0 release

thanks @dreamer-89, I think it is a bug, the _type field should not be exposed anywhere (since we removed relevant queries as well).

@dreamer-89
Copy link
Member Author

I see exists query with _type value in field fetches all record. I am not sure if this is a bug and should be fixed in 2.0 release

thanks @dreamer-89, I think it is a bug, the _type field should not be exposed anywhere (since we removed relevant queries as well).

Thanks @reta. Created #2989 to track this.

@dreamer-89
Copy link
Member Author

This is implemented in #3016 and thus can be closed.

@dreamer-89 dreamer-89 added the v2.0.0 Version 2.0.0 label Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request Indexing & Search v2.0.0 Version 2.0.0
Projects
None yet
Development

No branches or pull requests

3 participants