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

Range filter gt is broken #119

Closed
clintongormley opened this issue Apr 6, 2010 · 2 comments
Closed

Range filter gt is broken #119

clintongormley opened this issue Apr 6, 2010 · 2 comments

Comments

@clintongormley
Copy link

Hiya

The gt term to the range filter is broken. from with include_lower: false works correctly, and the gt term works correctly for range queries:

curl -XDELETE 'http://127.0.0.2:9200/es_test_1/' 
curl -XDELETE 'http://127.0.0.2:9200/es_test_2/' 
curl -XPOST 'http://127.0.0.2:9200/_refresh' 
curl -XGET 'http://127.0.0.2:9200/_cluster/health?timeout=2s&wait_for_status=green' 
curl -XPUT 'http://127.0.0.2:9200/es_test_1/'  -d '
{}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/'  -d '
{}
'
curl -XPUT 'http://127.0.0.2:9200/_all/type_1/_mapping'  -d '
{
   "_all" : {
      "store" : "yes",
      "term_vector" : "with_positions_offsets"
   },
   "properties" : {
      "num" : {
         "store" : "yes",
         "type" : "integer"
      },
      "date" : {
         "format" : "yyyy-MM-dd HH:mm:ss",
         "type" : "date"
      },
      "text" : {
         "store" : "yes",
         "type" : "string"
      }
   }
}
'
curl -XPUT 'http://127.0.0.2:9200/_all/type_2/_mapping'  -d '
{
   "_all" : {
      "store" : "yes",
      "term_vector" : "with_positions_offsets"
   },
   "properties" : {
      "num" : {
         "store" : "yes",
         "type" : "integer"
      },
      "date" : {
         "format" : "yyyy-MM-dd HH:mm:ss",
         "type" : "date"
      },
      "text" : {
         "store" : "yes",
         "type" : "string"
      }
   }
}
'
curl -XPOST 'http://127.0.0.2:9200/_refresh' 
curl -XGET 'http://127.0.0.2:9200/_cluster/health?timeout=2s&wait_for_status=green' 
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_1/1/_create'  -d '
{
   "num" : "2",
   "date" : "2010-04-2 00:00:00",
   "text" : "foo"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_2/2/_create'  -d '
{
   "num" : "3",
   "date" : "2010-04-3 00:00:00",
   "text" : "foo"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/3/_create'  -d '
{
   "num" : "4",
   "date" : "2010-04-4 00:00:00",
   "text" : "foo"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/4/_create'  -d '
{
   "num" : "5",
   "date" : "2010-04-5 00:00:00",
   "text" : "foo"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_1/5/_create'  -d '
{
   "num" : "6",
   "date" : "2010-04-6 00:00:00",
   "text" : "foo bar"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_2/6/_create'  -d '
{
   "num" : "7",
   "date" : "2010-04-7 00:00:00",
   "text" : "foo bar"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/7/_create'  -d '
{
   "num" : "8",
   "date" : "2010-04-8 00:00:00",
   "text" : "foo bar"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/8/_create'  -d '
{
   "num" : "9",
   "date" : "2010-04-9 00:00:00",
   "text" : "foo bar"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_1/9/_create'  -d '
{
   "num" : "10",
   "date" : "2010-04-10 00:00:00",
   "text" : "foo bar baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_2/10/_create'  -d '
{
   "num" : "11",
   "date" : "2010-04-11 00:00:00",
   "text" : "foo bar baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/11/_create'  -d '
{
   "num" : "12",
   "date" : "2010-04-12 00:00:00",
   "text" : "foo bar baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/12/_create'  -d '
{
   "num" : "13",
   "date" : "2010-04-13 00:00:00",
   "text" : "foo bar baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_1/13/_create'  -d '
{
   "num" : "14",
   "date" : "2010-04-14 00:00:00",
   "text" : "bar baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_2/14/_create'  -d '
{
   "num" : "15",
   "date" : "2010-04-15 00:00:00",
   "text" : "bar baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/15/_create'  -d '
{
   "num" : "16",
   "date" : "2010-04-16 00:00:00",
   "text" : "bar baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/16/_create'  -d '
{
   "num" : "17",
   "date" : "2010-04-17 00:00:00",
   "text" : "bar baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_1/17/_create'  -d '
{
   "num" : "18",
   "date" : "2010-04-18 00:00:00",
   "text" : "baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_2/18/_create'  -d '
{
   "num" : "19",
   "date" : "2010-04-19 00:00:00",
   "text" : "baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/19/_create'  -d '
{
   "num" : "20",
   "date" : "2010-04-20 00:00:00",
   "text" : "baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/20/_create'  -d '
{
   "num" : "21",
   "date" : "2010-04-21 00:00:00",
   "text" : "baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_1/21/_create'  -d '
{
   "num" : "22",
   "date" : "2010-04-22 00:00:00",
   "text" : "bar"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_2/22/_create'  -d '
{
   "num" : "23",
   "date" : "2010-04-23 00:00:00",
   "text" : "bar"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/23/_create'  -d '
{
   "num" : "24",
   "date" : "2010-04-24 00:00:00",
   "text" : "bar"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/24/_create'  -d '
{
   "num" : "25",
   "date" : "2010-04-25 00:00:00",
   "text" : "bar"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_1/25/_create'  -d '
{
   "num" : "26",
   "date" : "2010-04-26 00:00:00",
   "text" : "foo baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_1/type_2/26/_create'  -d '
{
   "num" : "27",
   "date" : "2010-04-27 00:00:00",
   "text" : "foo baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_1/27/_create'  -d '
{
   "num" : "28",
   "date" : "2010-04-28 00:00:00",
   "text" : "foo baz"
}
'
curl -XPUT 'http://127.0.0.2:9200/es_test_2/type_2/28/_create'  -d '
{
   "num" : "29",
   "date" : "2010-04-29 00:00:00",
   "text" : "foo baz"
}
'
curl -XPOST 'http://127.0.0.2:9200/_refresh' 

echo "

RUNNING QUERIES:

RANGE FILTER GTE:
"

curl -XGET 'http://127.0.0.2:9200/_search?search_type=query_then_fetch&pretty=true'  -d '
{
   "fields" : [],
   "size": 1,
   "query" : {
      "filtered" : {
         "filter" : {
            "range" : {
               "num" : {
                  "gte" : 10
               }
            }
         },
         "query" : {
            "match_all" : {}
         }
      }
   }
}
'

echo "

RANGE FILTER GT

"
curl -XGET 'http://127.0.0.2:9200/_search?search_type=query_then_fetch&pretty=true'  -d '
{
   "fields" : [],
   "size": 1,
   "query" : {
      "filtered" : {
         "filter" : {
            "range" : {
               "num" : {
                  "gt" : 10
               }
            }
         },
         "query" : {
            "match_all" : {}
         }
      }
   }
}
'
echo "

RANGE FILTER FROM/INCLUDE_LOWER

"
curl -XGET 'http://127.0.0.2:9200/_search?search_type=query_then_fetch&pretty=true'  -d '
{
   "fields" : [],
   "size": 1,
   "query" : {
      "filtered" : {
         "filter" : {
            "range" : {
               "num" : {
                  "from" : 10,
                  "include_lower": false
               }
            }
         },
         "query" : {
            "match_all" : {}
         }
      }
   }
}
'

echo "

RANGE QUERY FROM/INCLUDE_LOWER

"
curl -XGET 'http://127.0.0.2:9200/_search?search_type=query_then_fetch&pretty=true'  -d '
{
   "fields" : [],
   "size": 1,
   "query" : {
        "range" : {
           "num" : {
              "gt" : 10
           }
        }
   }
}
'
@kimchy
Copy link
Member

kimchy commented Apr 6, 2010

Range filter gt is broken, closed by 1a9c5d6.

@clintongormley
Copy link
Author

Fixed++

tlrx added a commit that referenced this issue Jun 5, 2015
williamrandolph pushed a commit to williamrandolph/elasticsearch that referenced this issue Jun 4, 2020
use the tuple aliased name rather then the index to place data into the tuple
fix elastic#119
mindw pushed a commit to mindw/elasticsearch that referenced this issue Sep 5, 2022
add rotem

* add rotem

Approved-by: Gideon Avida
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this issue Oct 2, 2023
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