sql server - Elastic search does not returns any results -
i trying use elastic search mssql cant find results
the table name orders_table , fields [orderid],[customername],[userfullname],[status]
step 1: build index
post /_river/mytest_river/_meta { "type":"jdbc", "jdbc": { "driver":"com.microsoft.sqlserver.jdbc.sqlserverdriver", "url":"jdbc:sqlserver://[my_ip];databasename=mega", "user":"sa","password":"******", "sql":"select [orderid],[customername],[userfullname],[status] [orders_table]", "poll":"5s", "index": "mega", "type": "orders_table" } }
the result
{ "_index": "_river", "_type": "mytest_river", "_id": "_meta", "_version": 2, "created": false }
step 2: mappings
put /_river/_mappings/orders_table { "orders_table" : { "properties" : { "orderid" : {"type" : "integer"}, "customername" : {"type" : "string" }, "userfullname" : {"type" : "string" }, "status" : {"type" : "string" } } } }
the result
{ "acknowledged": true }
step 3: _search
post /_river/mytest_river/_search { "query": { "multi_match": { "query": "7694964", "fields": [ "orderid" ] } } }
the results
{ "took": 4, "timed_out": false, "_shards": { "total": 1, "successful": 1, "failed": 0 }, "hits": { "total": 0, "max_score": null, "hits": [] } }
why row [orderid]=7694964 not found?
why hits 0??
how can bring table results instead of hits?
try
post /mega/orders_table/_search { "query": { "multi_match": { "query": "7694964", "fields": [ "orderid" ] } }, "size": 100 }
to 100 documents or use scan , scroll paginated results or from/size same. but, careful size
, don't want set big values in there because can bring cluster down. best be, if have many documents, use scan , scroll.
Comments
Post a Comment