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

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

Closed
clintongormley opened this issue Feb 19, 2010 · 3 comments

Comments

@clintongormley
Copy link
Contributor

  • 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" : {}
   }
}
'
@clintongormley
Copy link
Contributor Author

This sort works correctly if all /index/type combinations have num mapped as integer

@kimchy
Copy link
Member

kimchy commented Feb 22, 2010

Well, I tracked down the problem... . First, the search operation will not hang now (I just pushed a fix for it). The reason this fails is because when there is no mapping for a number, it is treated as a long, and when trying to compare long to ints the reduce phase fails. Now, you will get a failed response because of that. I still need to think how to support this (we should...).

@clintongormley
Copy link
Contributor Author

It now throws an exception correctly

dadoonet added a commit that referenced this issue Jun 5, 2015
johtani added a commit that referenced this issue Jun 5, 2015
The `kuromoji` analyzer is not registered as a global analyzer, so this fails:

    POST /_analyze?analyzer=kuromoji&text=J R 新宿駅の近くにビールを飲みに行こうか

    {
       "error": "ElasticsearchIllegalArgumentException[failed to find analyzer [kuromoji]]",
       "status": 400
    }

But this succeeds:

    PUT /t
    POST /t/_analyze?analyzer=kuromoji&text=J R 新宿駅の近くにビールを飲みに行こうか

Closes #31.
dadoonet added a commit that referenced this issue Jun 5, 2015
Closes #31.

(cherry picked from commit 39b83f0)
dadoonet added a commit that referenced this issue Jun 5, 2015
Closes #31.

(cherry picked from commit ab3cde3)
dadoonet added a commit that referenced this issue Jun 5, 2015
dadoonet added a commit that referenced this issue Jun 5, 2015
Due to this [change](#8018), we need to fix our tests for elasticsearch 1.4.0 and above.

Closes #31.

(cherry picked from commit 3eeb827)
ywelsch pushed a commit to ywelsch/elasticsearch that referenced this issue Apr 24, 2018
Previously, we track the next wake-up time in Legislator and also have to
track the leaderMode (whether publishing or sending a heartbeat).

This change gets rid of this state, instead using the FutureExecutor to
schedule the future wake-ups.
ClaudioMFreitas pushed a commit to ClaudioMFreitas/elasticsearch-1 that referenced this issue Nov 12, 2019
Changed Readme and added template install
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants