2017-03-22 2 views
0

Jeder. Dies ist ein einfacher Test-Code mit den elasitcsearch document urlelasticsearch range filter incorrect

curl -XPOST 'localhost:9200/customer/external/_search?pretty' 

{ "nahm": 3, "timed_out": false, "_shards": { "total": 5, "erfolgreich" : 5, "nicht bestanden": 0 }, "Hits": { "total": 2, "max_score": 1,0, "Hits": [{ "_index": "Kunde", " _type ":" extern ", "_id": "1", "_score": 1.0, "_source": {"alter": 20, "balance": 100000, "name": "Thomas.St.Wang"} }, { "_index": "Kunde", "_type": "extern", "_id": "2", "_score": 1,0, "_source": {"Alter": 19, "balance": 10000, "name": "TSW"} }] } }


die folgende Anfrage ist nicht das Ergebnis, das ich erwarte. Warum.

curl -XPOST 'localhost:9200/customer/external/_search?pretty' -d 

'{"query": {"filtered":{ "query" :{"match_all": {} }, "filter": {"range": {"balance": {"gte" : 9999, "lte" : 100001 } } } } } }' 

{ "nahm": 2 "timed_out": false, "_shards": { "total": 5, "erfolgreich": 5, "nicht bestanden": 0} " Hits“: { "total": 0, "max_score": null, "Hits": []}}

Was mit meiner Anfrage falsch ist? Vielen Dank.

Antwort

0
curl -XGET 'localhost:9200/customer/_mapping/external/field/balance' 

{ "Kunde": { "Mappings": { "extern": { "Balance": { "full_name": "Balance", "Mapping": { "Balance": { "type ":" string "}}}}}}}

Dies ist die Antwort. Weil das Saldofeld eine Zeichenfolge ist. Ich muss den Index löschen und Index es neu starten.