search - ElasticSearch: Query number field to use like clause as we do for string field -


i have 2 fields in elasticsearch cache created using oracle river-jdbc.
first column numeric , second string name.

i want use indexing in autocomplete textbox using jquery.

all implementation done name field.
user can provide string (at least 3 characters) hit goes elasticsearch given string , searches data "in-string" part of name field , returns result. querying in sql using like operator name field , it's working , data loaded in ui.

i want same numeric field, until , unless give complete value of numeric field elasticsearch doesn't return data. autocomplete not works numeric field.

below code:

creating river field as:

{     "type": "jdbc",     "jdbc": {         "driver": "oracle.jdbc.driver.oracledriver",         "url": "jdbc:oracle:thin:@//<ip-addr>:1521/db",         "user": "user",         "password": "pwd",         "sql": "select curr_duns_number duns, trim(name) company subject rownum < 10000"     },     "index": {         "index": "subject",         "type": "name"     },     "properties": {         "duns": {"type": "string", "store": "yes"},         "company": {"type": "string"}     } } 

fetching company field:

post http://<ip-addr>:9200/subject/name/_search {     "from": 0,     "size": 10,     "query": {         "wildcard": {             "company": "boo*"         }     },     "sort": [         {             "company": {"order": "asc"}         }     ] } 

after trying various combinations wildcard, matching, , query_string doesn't give me results, , i'm left following problems:

  1. i cannot query numeric fields in similar way how it's done using sql, e.g. select * subject curr_duns_number '%123%';
  2. sorting order not applied token sorting elasticsearch considering word company name.

well after research not find answer on this. solution changed type of numeric field string appending string , achieve auto-completion project.

for sake of closing question accepting answer if solution comes in future add or 1 can add comments it.

thanks


Comments