1
내가 사용하고 Flashlight Firebase 플러그인중포 기지 손전등 (ElasticSearch) 필터링, 정렬, 페이지 매김
나는이 example을 사용하고 있으며이 예에서 잘
을 작동하고 당신이 example.js 파일을 볼 수는 쿼리에 대한 방법을 I는 JSO 을 다음과 같은 값을 전달할 때, 상기 기능
// display search results
function doSearch(index, type, query) {
var ref = database.ref().child(PATH);
var key = ref.child('request').push({ index: index, type: type, query: query } ).key;
ref.child('response/'+key).on('value', showResults);
}
아래 나에게 결과를 반환 내가 나에게 결과
http://localhost:9200/firebase/user/_search?q=*mani*&pretty&size=5&from=1
를 반환 JSON
{ index: index, type: type, query: { "from" : 1, "size" : 5 , "query": query }
을 다음과 같이 값을 전달하려고 노력하지만 ElasticSearch API을 다음입니다 때 N
{ index: index, type: type, query: query }
것은 나에게 아무 것도 반환하지 않습니다 및 다음과 같이 손전등을 사용하여 쿼리를 필터링하는 방법
{
"rules": {
".read": false,
".write": false,
"search": {
"request": {
"$recid": {
// I can only read records assigned to me
".read": "auth.id === data.child('id').val() || auth.uid === data.child('id').val()",
// I can only write new records that don't exist yet
".write": "!data.exists() && (newData.child('id').val() === auth.id || newData.child('id').val() === auth.uid)",
".validate": "newData.hasChildren(['query', 'index', 'type'])",
"index": {
// accepts arrays or strings
".validate": "(newData.isString() && newData.val().length < 1000) || newData.hasChildren()",
"$child": {
".validate": "newData.isString() && newData.val().length < 1000"
}
},
"type": {
// accepts arrays or strings
".validate": "(newData.isString() && newData.val().length < 1000) || newData.hasChildren()",
"$child": {
".validate": "newData.isString() && newData.val().length < 1000"
}
},
"query": {
// structure of the query object is pretty open-ended
".validate": "newData.isString() || newData.hasChildren()"
},
"$other": {
".validate": false
}
}
},
"response": {
"$recid": {
// I can only read/write records assigned to me
".read": "auth.id === data.child('id').val() || auth.uid === data.child('id').val()",
".write": "auth.id === data.child('id').val() || auth.uid === data.child('id').val()",
// Assumes that Flashlight will be writing the records using a secret or a token that has admin: true
// The only thing a logged in user needs to do is delete results after reading them
".validate": false
}
}
}
}
}
날 손전등 마지막으로 내가 나 자신 여기
했다