-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Elasticsearch version (bin/elasticsearch --version):
Version: 6.3.0, Build: default/zip/424e937/2018-06-11T23:38:03.357887Z, JVM: 1.8.0_171
Plugins installed: None
JVM version (java -version):
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-1~bpo8+1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
OS version (uname -a if on a Unix-like system):
Linux tony-laptop 3.16.0-4-amd64 #1 SMP Debian 3.16.51-3 (2017-12-13) x86_64 GNU/Linux
Description of the problem including expected versus actual behavior:
I run a query on _type field and received HTTP 400 for "cannot search on field [_type] since it is not indexed".
According to the documentation, "The _type field is indexed in order to make searching by type name fast." I expect to receive a correct result not an error.
Steps to reproduce:
Create mappings:
PUT /test_schema_1
{
"settings":{
"index":{
"number_of_shards":1,
"number_of_replicas":0
}
}
}
PUT /test_schema_1/_mapping/test_table_1
{"test_table_1":{"properties":{"text_field":{"type":"text"}}}}
Query:
POST /test_schema_1/test_table_1/_search?size=4000&preference=_shards%3A0&scroll=300000ms
{
"from" : 0,
"size" : 4000,
"query" : {
"range" : {
"_type" : {
"from" : " ",
"to" : null,
"include_lower" : false,
"include_upper" : true,
"boost" : 1.0
}
}
}
}
Response:
{
"error": {
"root_cause": [
{
"type": "query_shard_exception",
"reason": "failed to create query: {\n \"range\" : {\n \"_type\" : {\n \"from\" : \" \",\n \"to\" : null,\n \"include_lower\" : false,\n \"include_upper\" : true,\n \"boost\" : 1.0\n }\n }\n}",
"index_uuid": "B6LluE64RhqZhIoVufFXSQ",
"index": "test_schema_1"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "test_schema_1",
"node": "7RkRZhIBQPKc43Lyr6ZY4A",
"reason": {
"type": "query_shard_exception",
"reason": "failed to create query: {\n \"range\" : {\n \"_type\" : {\n \"from\" : \" \",\n \"to\" : null,\n \"include_lower\" : false,\n \"include_upper\" : true,\n \"boost\" : 1.0\n }\n }\n}",
"index_uuid": "B6LluE64RhqZhIoVufFXSQ",
"index": "test_schema_1",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Cannot search on field [_type] since it is not indexed."
}
}
}
]
},
"status": 400
}
I am aware that _type is being deprecated. Should the documentation be updated to reflect that _type is no longer indexed? Or is there a bug?