I have 2 fields in my Elasticsearch cache that I created using Oracle river-jdbc.
First column is numeric and second is string as name.
I want to use this indexing in autocomplete textbox using jQuery.
All implementation is done for the name field.
User can provide any string (at least 3 characters) then hit goes to Elasticsearch with the given string and searches data as it is "In-String" part of name field and returns the result.  Similarly to querying in SQL using the LIKE operator for name field and it's working and data is loaded in the UI.
I want to do the same with the numeric field, but until and unless I give complete value of the numeric field Elasticsearch doesn't return any data. So autocomplete does not works for numeric field.
Below is the 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 as duns, TRIM(name) as company from subject where 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 like wildcard, matching, and query_string it doesn't give me results, and I'm left with the following problems:
- I cannot query numeric fields in a similar way to how it's done using SQL, e.g. select * from subject where curr_duns_number like '%123%';
- Sorting order is not properly applied as the token for sorting Elasticsearch is considering is usually a word from company name.
 
    