有人可以告诉我如何在Android上正确编写查询ElasticSearch吗? 目前我正是这样做的:
Map<String, Object> matched = new HashMap<>();
matched.put("userName", "skye");
Map<String, Object> match = new HashMap<>();
match.put("match", matched);
Map<String, Object> must = new HashMap<>();
must.put("must", match);
Map<String, Object> query = new HashMap<>();
query.put("bool", must);
Map<String, Object> q = new HashMap<>();
q.put("index","firebase");
q.put("type", "user");
q.put("query", query);
DatabaseReference ref = App.getDatabase().getReference("search");
String key = ref.child("request").push().getKey();
ref.child("request").child(key).setValue(q);
这是数据结构:
users: {
uid: {
"userName": "",
....
}...
}
和config.js路径:
{
path: "users",
index: "firebase",
type: "User"
}
当我在代码上面执行时,它返回0总值。 我做得对吗?