Skip to content

Sorting on a field explicitly mapped as an integer fails when not all types mapped as well #31

Closed
@clintongormley

Description

@clintongormley
  • create two indices 'es_test' and 'es_test_2'
  • create a mapping for 'type_1' which includes { num: { type: "integer"}
  • store documents as /es_test|es_test_2/type_1|type_2 with integer values in num
  • search on all indices and types, sorting by num
  • server hangs

Test script:

curl -XGET 'http://127.0.0.1:9200/_cluster/nodes' 
curl -XDELETE 'http://127.0.0.2:9200/es_test/' 
curl -XDELETE 'http://127.0.0.2:9200/es_test_2/' 
curl -XPOST 'http://127.0.0.2:9200/_flush?refresh=true' 
curl -XPUT 'http://127.0.0.2:9200/es_test/' 
curl -XPUT 'http://127.0.0.2:9200/es_test_2/'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_1/_mapping'  -d '
{
   "properties" : {
      "num" : {
         "type" : "integer"
      },
      "text" : {
         "type" : "string"
      }
   }
}
'
curl -XPOST 'http://127.0.0.2:9200/_flush?refresh=true' 
curl -XPUT 'http://127.0.0.2:9200/es_test/type_1/1?opType=create'  -d '{
   "num" : 2,   "text" : "foo"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_2/2?opType=create'  -d '{
   "num" : 3,   "text" : "foo"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/3?opType=create'  -d '{
   "num" : 4,   "text" : "foo"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/4?opType=create'  -d '{
   "num" : 5,   "text" : "foo"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_1/5?opType=create'  -d '{
   "num" : 6,   "text" : "foo bar"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_2/6?opType=create'  -d '{
   "num" : 7,   "text" : "foo bar"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/7?opType=create'  -d '{
   "num" : 8,   "text" : "foo bar"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/8?opType=create'  -d '{
   "num" : 9,   "text" : "foo bar"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_1/9?opType=create'  -d '{
   "num" : 10,   "text" : "foo bar baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_2/10?opType=create'  -d '{
   "num" : 11,   "text" : "foo bar baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/11?opType=create'  -d '{
   "num" : 12,   "text" : "foo bar baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/12?opType=create'  -d '{
   "num" : 13,   "text" : "foo bar baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_1/13?opType=create'  -d '{
   "num" : 14,   "text" : "bar baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_2/14?opType=create'  -d '{
   "num" : 15,   "text" : "bar baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/15?opType=create'  -d '{
   "num" : 16,   "text" : "bar baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/16?opType=create'  -d '{
   "num" : 17,   "text" : "bar baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_1/17?opType=create'  -d '{
   "num" : 18,   "text" : "baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_2/18?opType=create'  -d '{
   "num" : 19,   "text" : "baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/19?opType=create'  -d '{
   "num" : 20,   "text" : "baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/20?opType=create'  -d '{
   "num" : 21,   "text" : "baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_1/21?opType=create'  -d '{
   "num" : 22,   "text" : "bar"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_2/22?opType=create'  -d '{
   "num" : 23,   "text" : "bar"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/23?opType=create'  -d '{
   "num" : 24,   "text" : "bar"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/24?opType=create'  -d '{
   "num" : 25,   "text" : "bar"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_1/25?opType=create'  -d '{
   "num" : 26,   "text" : "foo baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test/type_2/26?opType=create'  -d '{
   "num" : 27,   "text" : "foo baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/27?opType=create'  -d '{
   "num" : 28,   "text" : "foo baz"}'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/28?opType=create'  -d '{
   "num" : 29,   "text" : "foo baz"}'


curl -XPOST 'http://127.0.0.2:9200/_flush?refresh=true' 


curl -XGET 'http://127.0.0.2:9200/_all/_search'  -d '
{
   "sort" : {
      "num" : {}
   },
   "query" : {
      "matchAll" : {}
   }
}
'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions