{ "6341d990473a73a50895c5a12e23da471b4a339ee8d5efb9615c45e5b14f43e1": { "original": "CODE_BLOCK_23\n\nJSON:\n\n\nCODE_BLOCK_24\n\n\nCODE_BLOCK_25\n\nPHP:\n\n\nCODE_BLOCK_26\n\n\nCODE_BLOCK_27\n\nPython\n\n\nCODE_BLOCK_28\n\nCODE_BLOCK_29\n\n\nPython-asyncio\n\n\nCODE_BLOCK_30\n\nCODE_BLOCK_31\n\n\njavascript\n\n\nCODE_BLOCK_32\n\nCODE_BLOCK_33\n\njava\n\n\nCODE_BLOCK_34\n\nCODE_BLOCK_35\n\n\nC#\n\n\nCODE_BLOCK_36\n\nCODE_BLOCK_37\n\n\nRust\n\n\nCODE_BLOCK_38\n\nCODE_BLOCK_39\n\n\nTypeScript\n\n\nCODE_BLOCK_40\n\nCODE_BLOCK_41\n\n\nGo\n\n\nCODE_BLOCK_42\n\nCODE_BLOCK_43\n\n\n\n\n##### I want to know complete PQ rules matching my document\n\nSQL:\n\n\nCODE_BLOCK_44\n\n\nCODE_BLOCK_45\n\nJSON:\n\n\nCODE_BLOCK_46\n\n\nCODE_BLOCK_47\n\nPHP:\n\n\nCODE_BLOCK_48\n\n\nCODE_BLOCK_49\n\n\nPython\n\n\nCODE_BLOCK_50\n\nCODE_BLOCK_51\n\n\nPython-asyncio\n\n\nCODE_BLOCK_52\n\nCODE_BLOCK_53\n\n\njavascript\n\n\nCODE_BLOCK_54\n\nCODE_BLOCK_55\n\n\njava\n\n\nCODE_BLOCK_56\n\nCODE_BLOCK_57\n\n\nC#\n\n\nCODE_BLOCK_58\n\nCODE_BLOCK_59\n\n\nRust\n\n\nCODE_BLOCK_60\n\nCODE_BLOCK_61\n\n\nTypeScript\n\n\nCODE_BLOCK_62\n\nCODE_BLOCK_63\n\n\nGo\n\n\nCODE_BLOCK_64\n\nCODE_BLOCK_65\n\n\n\n\n\n##### How about multiple documents?\n\nNote that with `CALL PQ`, you can provide multiple documents in different ways:\n\n* as an array of plain documents in round brackets `('doc1', 'doc2')`. This requires `0 as docs_json`\n* as an array of JSONs in round brackets `('{doc1}', '{doc2}')`\n* or as a standard JSON array `'[{doc1}, {doc2}]'`\n\n\nSQL:\n\n\nCODE_BLOCK_66\n\n\nCODE_BLOCK_67\n\nJSON:\n\n\nCODE_BLOCK_68\n\n\nCODE_BLOCK_69\n\nPHP:\n\n\nCODE_BLOCK_70\n\n\nCODE_BLOCK_71\n\nPython\n\n\nCODE_BLOCK_72\n\nCODE_BLOCK_73\n\n\nPython-asyncio\n\n\nCODE_BLOCK_74\n\nCODE_BLOCK_75\n\n\njavascript\n\n\nCODE_BLOCK_76\n\nCODE_BLOCK_77\n\n\njava\n\n\nCODE_BLOCK_78\n\nCODE_BLOCK_79\n\n\nC#\n\n\nCODE_BLOCK_80\n\nCODE_BLOCK_81\n\n\nRust\n\n\nCODE_BLOCK_82\n\nCODE_BLOCK_83\n\n\nTypeScript\n\n\nCODE_BLOCK_84\n\nCODE_BLOCK_85\n\n\nGo\n\n\nCODE_BLOCK_86\n\nCODE_BLOCK_87\n\n\n\n\n##### I want to know what docs match what rules\n\nUsing the option `1 as docs` allows you to see which documents of the provided ones match which rules.\n\nSQL:\n\n\nCODE_BLOCK_88\n\n\n\nCODE_BLOCK_89\n\nJSON:\n\n\nCODE_BLOCK_90\n\n\nCODE_BLOCK_91\n\nPHP:\n\n\nCODE_BLOCK_92\n\n\nCODE_BLOCK_93\n\nPython\n\n\nCODE_BLOCK_94\n\nCODE_BLOCK_95\n\n\nPython-asyncio\n\n\nCODE_BLOCK_96\n\nCODE_BLOCK_97\n\n\njavascript\n\n\nCODE_BLOCK_98\n\nCODE_BLOCK_99\n\njava\n\n\nCODE_BLOCK_100\n\nCODE_BLOCK_101\n\n\nC#\n\n\nCODE_BLOCK_102\n\nCODE_BLOCK_103\n\n\nRust\n\n\nCODE_BLOCK_104\n\nCODE_BLOCK_105\n\n\nTypeScript\n\n\nCODE_BLOCK_106\n\nCODE_BLOCK_107\n\n\nGo\n\n\nCODE_BLOCK_108\n\nCODE_BLOCK_109\n\n\n\n\n#### Static ids\nBy default, matching document ids correspond to their relative numbers in the list you provide. However, in some cases, each document already has its own id. For this case, there's an option `'id field name' as docs_id` for `CALL PQ`.\n\nNote that if the id cannot be found by the provided field name, the PQ rule will not be shown in the results.\n\nThis option is only available for `CALL PQ` via SQL.\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_110\n\n\nCODE_BLOCK_111\n\n\n\n##### I may have invalid JSONs, please skip them\n\nWhen using CALL PQ with separate JSONs, you can use the option 1 as skip_bad_json to skip any invalid JSONs in the input. In the example below, the 2nd query fails due to an invalid JSON, but the 3rd query avoids the error by using 1 as skip_bad_json. Keep in mind that this option is not available when sending JSON queries over HTTP, as the whole JSON query must be valid in that case.\n\n\nSQL:\n\n\nCODE_BLOCK_112\n\n\nCODE_BLOCK_113", "translations": { "chinese": "CODE_BLOCK_23\n\nJSON:\n\n\nCODE_BLOCK_24\n\n\nCODE_BLOCK_25\n\nPHP:\n\n\nCODE_BLOCK_26\n\n\nCODE_BLOCK_27\n\nPython\n\n\nCODE_BLOCK_28\n\nCODE_BLOCK_29\n\n\nPython-asyncio\n\n\nCODE_BLOCK_30\n\nCODE_BLOCK_31\n\n\njavascript\n\n\nCODE_BLOCK_32\n\nCODE_BLOCK_33\n\njava\n\n\nCODE_BLOCK_34\n\nCODE_BLOCK_35\n\n\nC#\n\n\nCODE_BLOCK_36\n\nCODE_BLOCK_37\n\n\nRust\n\n\nCODE_BLOCK_38\n\nCODE_BLOCK_39\n\n\nTypeScript\n\n\nCODE_BLOCK_40\n\nCODE_BLOCK_41\n\n\nGo\n\n\nCODE_BLOCK_42\n\nCODE_BLOCK_43\n\n\n\n\n##### \u6211\u60f3\u77e5\u9053\u5b8c\u5168\u5339\u914d\u6211\u6587\u6863\u7684 PQ \u89c4\u5219\n\nSQL:\n\n\nCODE_BLOCK_44\n\n\nCODE_BLOCK_45\n\nJSON:\n\n\nCODE_BLOCK_46\n\n\nCODE_BLOCK_47\n\nPHP:\n\n\nCODE_BLOCK_48\n\n\nCODE_BLOCK_49\n\n\nPython\n\n\nCODE_BLOCK_50\n\nCODE_BLOCK_51\n\n\nPython-asyncio\n\n\nCODE_BLOCK_52\n\nCODE_BLOCK_53\n\n\njavascript\n\n\nCODE_BLOCK_54\n\nCODE_BLOCK_55\n\n\njava\n\n\nCODE_BLOCK_56\n\nCODE_BLOCK_57\n\n\nC#\n\n\nCODE_BLOCK_58\n\nCODE_BLOCK_59\n\n\nRust\n\n\nCODE_BLOCK_60\n\nCODE_BLOCK_61\n\n\nTypeScript\n\n\nCODE_BLOCK_62\n\nCODE_BLOCK_63\n\n\nGo\n\n\nCODE_BLOCK_64\n\nCODE_BLOCK_65\n\n\n\n\n\n##### \u591a\u6587\u6863\u5982\u4f55\u5904\u7406\uff1f\n\n\u8bf7\u6ce8\u610f\uff0c\u4f7f\u7528 `CALL PQ` \u65f6\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4e0d\u540c\u65b9\u5f0f\u63d0\u4f9b\u591a\u4e2a\u6587\u6863\uff1a\n\n* \u4f5c\u4e3a\u666e\u901a\u6587\u6863\u6570\u7ec4\uff0c\u4f7f\u7528\u5706\u62ec\u53f7\u5982 `('doc1', 'doc2')`\u3002\u8fd9\u9700\u8981 `0 as docs_json`\n* \u4f5c\u4e3a JSON \u6570\u7ec4\uff0c\u4f7f\u7528\u5706\u62ec\u53f7\u5982 `('{doc1}', '{doc2}')`\n* \u6216\u8005\u4f5c\u4e3a\u6807\u51c6 JSON \u6570\u7ec4 `'[{doc1}, {doc2}]'`\n\n\nSQL:\n\n\nCODE_BLOCK_66\n\n\nCODE_BLOCK_67\n\nJSON:\n\n\nCODE_BLOCK_68\n\n\nCODE_BLOCK_69\n\nPHP:\n\n\nCODE_BLOCK_70\n\n\nCODE_BLOCK_71\n\nPython\n\n\nCODE_BLOCK_72\n\nCODE_BLOCK_73\n\n\nPython-asyncio\n\n\nCODE_BLOCK_74\n\nCODE_BLOCK_75\n\n\njavascript\n\n\nCODE_BLOCK_76\n\nCODE_BLOCK_77\n\n\njava\n\n\nCODE_BLOCK_78\n\nCODE_BLOCK_79\n\n\nC#\n\n\nCODE_BLOCK_80\n\nCODE_BLOCK_81\n\n\nRust\n\n\nCODE_BLOCK_82\n\nCODE_BLOCK_83\n\n\nTypeScript\n\n\nCODE_BLOCK_84\n\nCODE_BLOCK_85\n\n\nGo\n\n\nCODE_BLOCK_86\n\nCODE_BLOCK_87\n\n\n\n\n##### \u6211\u60f3\u77e5\u9053\u54ea\u4e9b\u6587\u6863\u5339\u914d\u54ea\u4e9b\u89c4\u5219\n\n\u4f7f\u7528\u9009\u9879 `1 as docs` \u53ef\u4ee5\u8ba9\u4f60\u67e5\u770b\u6240\u63d0\u4f9b\u6587\u6863\u4e2d\u54ea\u4e9b\u5339\u914d\u4e86\u54ea\u4e9b\u89c4\u5219\u3002\n\nSQL:\n\n\nCODE_BLOCK_88\n\n\n\nCODE_BLOCK_89\n\nJSON:\n\n\nCODE_BLOCK_90\n\n\nCODE_BLOCK_91\n\nPHP:\n\n\nCODE_BLOCK_92\n\n\nCODE_BLOCK_93\n\nPython\n\n\nCODE_BLOCK_94\n\nCODE_BLOCK_95\n\n\nPython-asyncio\n\n\nCODE_BLOCK_96\n\nCODE_BLOCK_97\n\n\njavascript\n\n\nCODE_BLOCK_98\n\nCODE_BLOCK_99\n\njava\n\n\nCODE_BLOCK_100\n\nCODE_BLOCK_101\n\n\nC#\n\n\nCODE_BLOCK_102\n\nCODE_BLOCK_103\n\n\nRust\n\n\nCODE_BLOCK_104\n\nCODE_BLOCK_105\n\n\nTypeScript\n\n\nCODE_BLOCK_106\n\nCODE_BLOCK_107\n\n\nGo\n\n\nCODE_BLOCK_108\n\nCODE_BLOCK_109\n\n\n\n\n#### \u9759\u6001 id\n\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5339\u914d\u6587\u6863\u7684 id \u5bf9\u5e94\u4e8e\u4f60\u63d0\u4f9b\u5217\u8868\u4e2d\u7684\u76f8\u5bf9\u7f16\u53f7\u3002\u7136\u800c\uff0c\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6bcf\u4e2a\u6587\u6863\u5df2\u7ecf\u6709\u5b83\u81ea\u5df1\u7684 id\u3002\u5bf9\u4e8e\u8fd9\u79cd\u60c5\u51b5\uff0c`CALL PQ` \u63d0\u4f9b\u4e86\u9009\u9879 `'id field name' as docs_id`\u3002\n\n\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u901a\u8fc7\u63d0\u4f9b\u7684\u5b57\u6bb5\u540d\u627e\u4e0d\u5230 id\uff0c\u7ed3\u679c\u4e2d\u5c06\u4e0d\u4f1a\u663e\u793a\u8be5 PQ \u89c4\u5219\u3002\n\n\u6b64\u9009\u9879\u4ec5\u9002\u7528\u4e8e\u901a\u8fc7 SQL \u8c03\u7528 `CALL PQ`\u3002\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_110\n\n\nCODE_BLOCK_111\n\n\n\n##### \u6211\u53ef\u80fd\u6709\u65e0\u6548\u7684 JSON\uff0c\u8bf7\u8df3\u8fc7\u5b83\u4eec\n\n\u5f53\u4f7f\u7528 CALL PQ \u5904\u7406\u591a\u4e2a\u5355\u72ec\u7684 JSON \u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u9009\u9879 1 as skip_bad_json \u6765\u8df3\u8fc7\u8f93\u5165\u4e2d\u7684\u4efb\u4f55\u65e0\u6548 JSON\u3002\u4e0b\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u7b2c 2 \u4e2a\u67e5\u8be2\u56e0\u65e0\u6548 JSON \u800c\u5931\u8d25\uff0c\u4f46\u7b2c 3 \u4e2a\u67e5\u8be2\u901a\u8fc7\u4f7f\u7528 1 as skip_bad_json \u907f\u514d\u4e86\u9519\u8bef\u3002\u8bf7\u8bb0\u4f4f\uff0c\u5f53\u901a\u8fc7 HTTP \u53d1\u9001 JSON \u67e5\u8be2\u65f6\uff0c\u8fd9\u4e2a\u9009\u9879\u4e0d\u53ef\u7528\uff0c\u56e0\u4e3a\u6b64\u65f6\u6574\u4e2a JSON \u67e5\u8be2\u5fc5\u987b\u662f\u6709\u6548\u7684\u3002\n\n\nSQL:\n\n\nCODE_BLOCK_112\n\n\nCODE_BLOCK_113", "russian": "CODE_BLOCK_23\n\nJSON:\n\n\nCODE_BLOCK_24\n\n\nCODE_BLOCK_25\n\nPHP:\n\n\nCODE_BLOCK_26\n\n\nCODE_BLOCK_27\n\nPython\n\n\nCODE_BLOCK_28\n\nCODE_BLOCK_29\n\n\nPython-asyncio\n\n\nCODE_BLOCK_30\n\nCODE_BLOCK_31\n\n\njavascript\n\n\nCODE_BLOCK_32\n\nCODE_BLOCK_33\n\njava\n\n\nCODE_BLOCK_34\n\nCODE_BLOCK_35\n\n\nC#\n\n\nCODE_BLOCK_36\n\nCODE_BLOCK_37\n\n\nRust\n\n\nCODE_BLOCK_38\n\nCODE_BLOCK_39\n\n\nTypeScript\n\n\nCODE_BLOCK_40\n\nCODE_BLOCK_41\n\n\nGo\n\n\nCODE_BLOCK_42\n\nCODE_BLOCK_43\n\n\n\n\n##### \u042f \u0445\u043e\u0447\u0443 \u0443\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 PQ, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u043e\u0435\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443\n\nSQL:\n\n\nCODE_BLOCK_44\n\n\nCODE_BLOCK_45\n\nJSON:\n\n\nCODE_BLOCK_46\n\n\nCODE_BLOCK_47\n\nPHP:\n\n\nCODE_BLOCK_48\n\n\nCODE_BLOCK_49\n\n\nPython\n\n\nCODE_BLOCK_50\n\nCODE_BLOCK_51\n\n\nPython-asyncio\n\n\nCODE_BLOCK_52\n\nCODE_BLOCK_53\n\n\njavascript\n\n\nCODE_BLOCK_54\n\nCODE_BLOCK_55\n\n\njava\n\n\nCODE_BLOCK_56\n\nCODE_BLOCK_57\n\n\nC#\n\n\nCODE_BLOCK_58\n\nCODE_BLOCK_59\n\n\nRust\n\n\nCODE_BLOCK_60\n\nCODE_BLOCK_61\n\n\nTypeScript\n\n\nCODE_BLOCK_62\n\nCODE_BLOCK_63\n\n\nGo\n\n\nCODE_BLOCK_64\n\nCODE_BLOCK_65\n\n\n\n\n\n##### \u041a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432?\n\n\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e `CALL PQ` \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:\n\n* \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u0440\u0443\u0433\u043b\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 `('doc1', 'doc2')`. \u042d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 `0 as docs_json`\n* \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 JSON \u0432 \u043a\u0440\u0443\u0433\u043b\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 `('{doc1}', '{doc2}')`\n* \u0438\u043b\u0438 \u043a\u0430\u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 JSON-\u043c\u0430\u0441\u0441\u0438\u0432 `'[{doc1}, {doc2}]'`\n\n\nSQL:\n\n\nCODE_BLOCK_66\n\n\nCODE_BLOCK_67\n\nJSON:\n\n\nCODE_BLOCK_68\n\n\nCODE_BLOCK_69\n\nPHP:\n\n\nCODE_BLOCK_70\n\n\nCODE_BLOCK_71\n\nPython\n\n\nCODE_BLOCK_72\n\nCODE_BLOCK_73\n\n\nPython-asyncio\n\n\nCODE_BLOCK_74\n\nCODE_BLOCK_75\n\n\njavascript\n\n\nCODE_BLOCK_76\n\nCODE_BLOCK_77\n\n\njava\n\n\nCODE_BLOCK_78\n\nCODE_BLOCK_79\n\n\nC#\n\n\nCODE_BLOCK_80\n\nCODE_BLOCK_81\n\n\nRust\n\n\nCODE_BLOCK_82\n\nCODE_BLOCK_83\n\n\nTypeScript\n\n\nCODE_BLOCK_84\n\nCODE_BLOCK_85\n\n\nGo\n\n\nCODE_BLOCK_86\n\nCODE_BLOCK_87\n\n\n\n\n##### \u042f \u0445\u043e\u0447\u0443 \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043a\u0430\u043a\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\n\n\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0446\u0438\u0438 `1 as docs` \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u0437 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043a\u0430\u043a\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c.\n\nSQL:\n\n\nCODE_BLOCK_88\n\n\n\nCODE_BLOCK_89\n\nJSON:\n\n\nCODE_BLOCK_90\n\n\nCODE_BLOCK_91\n\nPHP:\n\n\nCODE_BLOCK_92\n\n\nCODE_BLOCK_93\n\nPython\n\n\nCODE_BLOCK_94\n\nCODE_BLOCK_95\n\n\nPython-asyncio\n\n\nCODE_BLOCK_96\n\nCODE_BLOCK_97\n\n\njavascript\n\n\nCODE_BLOCK_98\n\nCODE_BLOCK_99\n\njava\n\n\nCODE_BLOCK_100\n\nCODE_BLOCK_101\n\n\nC#\n\n\nCODE_BLOCK_102\n\nCODE_BLOCK_103\n\n\nRust\n\n\nCODE_BLOCK_104\n\nCODE_BLOCK_105\n\n\nTypeScript\n\n\nCODE_BLOCK_106\n\nCODE_BLOCK_107\n\n\nGo\n\n\nCODE_BLOCK_108\n\nCODE_BLOCK_109\n\n\n\n\n#### \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b\n\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0438\u0445 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043d\u043e\u043c\u0435\u0440\u0430\u043c \u0432 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0432\u0430\u043c\u0438 \u0441\u043f\u0438\u0441\u043a\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u043f\u0446\u0438\u044f `'id field name' as docs_id` \u0434\u043b\u044f `CALL PQ`.\n\n\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0439\u0434\u0435\u043d \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044f, \u043f\u0440\u0430\u0432\u0438\u043b\u043e PQ \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445.\n\n\u042d\u0442\u0430 \u043e\u043f\u0446\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f `CALL PQ` \u0447\u0435\u0440\u0435\u0437 SQL.\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_110\n\n\nCODE_BLOCK_111\n\n\n\n##### \u0423 \u043c\u0435\u043d\u044f \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 JSON, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0439\u0442\u0435 \u0438\u0445\n\n\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 CALL PQ \u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 JSON \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0446\u0438\u044e 1 as skip_bad_json, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 JSON \u0432 \u0432\u0432\u043e\u0434\u0435. \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043d\u0438\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 2-\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0438\u0437-\u0437\u0430 \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0433\u043e JSON, \u043d\u043e 3-\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438\u0437\u0431\u0435\u0433\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f 1 as skip_bad_json. \u0423\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u0430 \u043e\u043f\u0446\u0438\u044f \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u0440\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 JSON-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 HTTP, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0435\u0441\u044c JSON-\u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0435\u043d.\n\n\nSQL:\n\n\nCODE_BLOCK_112\n\n\nCODE_BLOCK_113" }, "is_code_or_comment": false, "model": "openai:gpt-4.1-mini", "updated_at": 1766339927 }, "0a2bd3aabd7b654c1a8bfd00ee113de6c8594e88a71110764b5a74f1f882382f": { "original": "\n\n##### I want higher performance of a percolate query\nPercolate queries are designed with high throughput and large data volumes in mind. To optimize performance for lower latency and higher throughput, consider the following.\n\nThere are two modes of distribution for a percolate table and how a percolate query can work against it:\n\n* **Sparse (default).** Ideal for: many documents, mirrored PQ tables. When your document set is large but the set of queries stored in the PQ table is small, the sparse mode is beneficial. In this mode, the batch of documents you pass will be divided among the number of agents, so each node processes only a portion of the documents from your request. Manticore splits your document set and distributes chunks among the mirrors. Once the agents have finished processing the queries, Manticore collects and merges the results, returning a final query set as if it came from a single table. Use [replication](../References.md#Replication) to assist the process.\n* **Sharded.** Ideal for: many PQ rules, rules split among PQ tables. In this mode, the entire document set is broadcast to all tables of the distributed PQ table without initially splitting the documents. This is beneficial when pushing a relatively small set of documents, but the number of stored queries is large. In this case, it's more appropriate to store only a portion of PQ rules on each node and then merge the results returned from the nodes that process the same set of documents against different sets of PQ rules. This mode must be explicitly set, as it implies an increase in network payload and expects tables with different PQs, which [replication](../References.md#Replication) cannot do out-of-the-box.\n\nAssume you have table `pq_d2` defined as:\n\nCODE_BLOCK_114\n\n\nEach of 'pq' and 'ptitle' contains:\n\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_115\n\n\n\nCODE_BLOCK_116\n\n\n\nCODE_BLOCK_117\n\n\n\nCODE_BLOCK_118\n\n\n\nCODE_BLOCK_119\n\n\n\nCODE_BLOCK_120\n\nPython\n\n\nCODE_BLOCK_121\n\nCODE_BLOCK_122\n\n\nPython-asyncio\n\n\nCODE_BLOCK_123\n\nCODE_BLOCK_124\n\n\njavascript\n\n\nCODE_BLOCK_125\n\nCODE_BLOCK_126\n\njavascript\n\n\nCODE_BLOCK_127\n\nCODE_BLOCK_128\n\n\njava\n\n\nCODE_BLOCK_129\n\nCODE_BLOCK_130\n\n\nC#\n\n\nCODE_BLOCK_131\n\nCODE_BLOCK_132\n\n\nRust\n\n\nCODE_BLOCK_133\n\nCODE_BLOCK_134\n\n\nTypeScript\n\n\nCODE_BLOCK_135\n\nCODE_BLOCK_136\n\n\nGo\n\n\nCODE_BLOCK_137\n\nCODE_BLOCK_138\n\n\n\n\n\n\nAnd you execute `CALL PQ` on the distributed table with a couple of documents.\n\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_139\n\n\n\nCODE_BLOCK_140\n\n\n\nCODE_BLOCK_141\n\n\n\nCODE_BLOCK_142\n\n\n\nCODE_BLOCK_143\n\n\n\nCODE_BLOCK_144\n\nPython\n\n\nCODE_BLOCK_145\n\nCODE_BLOCK_146\n\n\nPython-asyncio\n\n\nCODE_BLOCK_147\n\nCODE_BLOCK_148\n\n\njavascript\n\n\nCODE_BLOCK_149\n\nCODE_BLOCK_150\n\njava\n\n\nCODE_BLOCK_151\n\nCODE_BLOCK_152\n\n\nC#\n\n\nCODE_BLOCK_153\n\nCODE_BLOCK_154\n\n\nRust\n\n\nCODE_BLOCK_155\n\nCODE_BLOCK_156\n\n\nTypeScript\n\n\nCODE_BLOCK_157\n\nCODE_BLOCK_158\n\n\nGo\n\n\nCODE_BLOCK_159\n\nCODE_BLOCK_160\n\n\n\nIn the previous example, we used the default **sparse** mode. To demonstrate the **sharded** mode, let's create a distributed PQ table consisting of 2 local PQ tables and add 2 documents to \"products1\" and 1 document to \"products2\":\nCODE_BLOCK_161\n\n\nNow, if you add `'sharded' as mode` to `CALL PQ`, it will send the documents to all the agent's tables (in this case, just local tables, but they can be remote to utilize external hardware). This mode is not available via the JSON interface.\n\n\nSQL:\n\n\nCODE_BLOCK_162\n\n\nCODE_BLOCK_163\n\n\n\nNote that the syntax of agent mirrors in the configuration (when several hosts are assigned to one `agent` line, separated with `|`) has nothing to do with the `CALL PQ` query mode. Each `agent` always represents **one** node, regardless of the number of HA mirrors specified for that agent.\n\n\n##### How can I learn more about performance?\nIn some cases, you might want to get more details about the performance of a percolate query. For that purpose, there is the option `1 as verbose`, which is only available via SQL and allows you to save more performance metrics. You can see them using the `SHOW META` query, which you can run after `CALL PQ`. See [SHOW META](../Node_info_and_management/SHOW_META.md) for more info.\n\n\n1 as verbose:\n\n\nCODE_BLOCK_164\n\n\nCODE_BLOCK_165\n\n0 as verbose (default):\n\n\nCODE_BLOCK_166\n\n\nCODE_BLOCK_167\n\n\n\n", "translations": { "chinese": "\n\n##### \u6211\u60f3\u8981\u66f4\u9ad8\u6027\u80fd\u7684\u6e17\u900f\u67e5\u8be2\n\u6e17\u900f\u67e5\u8be2\u662f\u4e3a\u4e86\u9ad8\u541e\u5410\u91cf\u548c\u5927\u6570\u636e\u91cf\u800c\u8bbe\u8ba1\u7684\u3002\u4e3a\u4e86\u4f18\u5316\u4f4e\u5ef6\u8fdf\u548c\u9ad8\u541e\u5410\u91cf\u7684\u6027\u80fd\uff0c\u8bf7\u8003\u8651\u4ee5\u4e0b\u5185\u5bb9\u3002\n\n\u6e17\u900f\u8868\u6709\u4e24\u79cd\u5206\u53d1\u6a21\u5f0f\uff0c\u4ee5\u53ca\u6e17\u900f\u67e5\u8be2\u5982\u4f55\u5728\u5176\u4e0a\u5de5\u4f5c\uff1a\n\n* **\u7a00\u758f\uff08\u9ed8\u8ba4\uff09\u3002** \u7406\u60f3\u60c5\u51b5\uff1a\u8bb8\u591a\u6587\u6863\uff0c\u955c\u50cfPQ\u8868\u3002\u5f53\u60a8\u7684\u6587\u6863\u96c6\u5f88\u5927\uff0c\u4f46\u5b58\u50a8\u5728PQ\u8868\u4e2d\u7684\u67e5\u8be2\u96c6\u5f88\u5c0f\u65f6\uff0c\u7a00\u758f\u6a21\u5f0f\u662f\u6709\u5229\u7684\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e0b\uff0c\u60a8\u4f20\u9012\u7684\u6587\u6863\u6279\u6b21\u5c06\u88ab\u5206\u914d\u7ed9\u591a\u4e2a\u4ee3\u7406\uff0c\u56e0\u6b64\u6bcf\u4e2a\u8282\u70b9\u4ec5\u5904\u7406\u60a8\u8bf7\u6c42\u4e2d\u7684\u4e00\u90e8\u5206\u6587\u6863\u3002Manticore\u5c06\u60a8\u7684\u6587\u6863\u96c6\u62c6\u5206\u5e76\u5728\u955c\u50cf\u4e4b\u95f4\u5206\u53d1\u5757\u3002\u4e00\u65e6\u4ee3\u7406\u5b8c\u6210\u5904\u7406\u67e5\u8be2\uff0cManticore\u5c06\u6536\u96c6\u5e76\u5408\u5e76\u7ed3\u679c\uff0c\u8fd4\u56de\u4e00\u4e2a\u6700\u7ec8\u7684\u67e5\u8be2\u96c6\uff0c\u5c31\u50cf\u5b83\u6765\u81ea\u5355\u4e2a\u8868\u4e00\u6837\u3002\u4f7f\u7528[\u590d\u5236](../References.md#Replication)\u6765\u534f\u52a9\u8be5\u8fc7\u7a0b\u3002\n* **\u5206\u7247\u3002** \u7406\u60f3\u60c5\u51b5\uff1a\u8bb8\u591aPQ\u89c4\u5219\uff0c\u89c4\u5219\u5206\u5e03\u5728PQ\u8868\u4e4b\u95f4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e0b\uff0c\u6574\u4e2a\u6587\u6863\u96c6\u4f1a\u5e7f\u64ad\u5230\u5206\u5e03\u5f0fPQ\u8868\u7684\u6240\u6709\u8868\uff0c\u800c\u4e0d\u4f1a\u6700\u521d\u62c6\u5206\u6587\u6863\u3002\u5f53\u63a8\u9001\u76f8\u5bf9\u8f83\u5c0f\u7684\u6587\u6863\u96c6\u65f6\uff0c\u8fd9\u79cd\u65b9\u5f0f\u662f\u6709\u5229\u7684\uff0c\u4f46\u5b58\u50a8\u7684\u67e5\u8be2\u6570\u91cf\u5f88\u5927\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u66f4\u5408\u9002\u7684\u662f\u5728\u6bcf\u4e2a\u8282\u70b9\u4e0a\u4ec5\u5b58\u50a8\u4e00\u90e8\u5206PQ\u89c4\u5219\uff0c\u7136\u540e\u5408\u5e76\u4ece\u5904\u7406\u76f8\u540c\u6587\u6863\u96c6\u7684\u8282\u70b9\u8fd4\u56de\u7684\u7ed3\u679c\uff0c\u8fd9\u4e9b\u8282\u70b9\u9488\u5bf9\u4e0d\u540c\u7684PQ\u89c4\u5219\u96c6\u8fdb\u884c\u5904\u7406\u3002\u6b64\u6a21\u5f0f\u5fc5\u987b\u663e\u5f0f\u8bbe\u7f6e\uff0c\u56e0\u4e3a\u5b83\u610f\u5473\u7740\u7f51\u7edc\u8d1f\u8f7d\u7684\u589e\u52a0\uff0c\u5e76\u671f\u671b\u5177\u6709\u4e0d\u540cPQ\u7684\u8868\uff0c\u800c[\u590d\u5236](../References.md#Replication)\u65e0\u6cd5\u5f00\u7bb1\u5373\u7528\u5730\u505a\u5230\u8fd9\u4e00\u70b9\u3002\n\n\u5047\u8bbe\u60a8\u6709\u8868`pq_d2`\u5b9a\u4e49\u4e3a\uff1a\n\nCODE_BLOCK_114\n\n\n\u6bcf\u4e2a 'pq' \u548c 'ptitle' \u5305\u542b\uff1a\n\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_115\n\n\n\nCODE_BLOCK_116\n\n\n\nCODE_BLOCK_117\n\n\n\nCODE_BLOCK_118\n\n\n\nCODE_BLOCK_119\n\n\n\nCODE_BLOCK_120\n\nPython\n\n\nCODE_BLOCK_121\n\nCODE_BLOCK_122\n\n\nPython-asyncio\n\n\nCODE_BLOCK_123\n\nCODE_BLOCK_124\n\n\njavascript\n\n\nCODE_BLOCK_125\n\nCODE_BLOCK_126\n\njavascript\n\n\nCODE_BLOCK_127\n\nCODE_BLOCK_128\n\n\njava\n\n\nCODE_BLOCK_129\n\nCODE_BLOCK_130\n\n\nC#\n\n\nCODE_BLOCK_131\n\nCODE_BLOCK_132\n\n\nRust\n\n\nCODE_BLOCK_133\n\nCODE_BLOCK_134\n\n\nTypeScript\n\n\nCODE_BLOCK_135\n\nCODE_BLOCK_136\n\n\nGo\n\n\nCODE_BLOCK_137\n\nCODE_BLOCK_138\n\n\n\n\n\n\n\u5e76\u4e14\u60a8\u5728\u5206\u5e03\u5f0f\u8868\u4e0a\u6267\u884c `CALL PQ`\uff0c\u5e26\u6709\u51e0\u4efd\u6587\u6863\u3002\n\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_139\n\n\n\nCODE_BLOCK_140\n\n\n\nCODE_BLOCK_141\n\n\n\nCODE_BLOCK_142\n\n\n\nCODE_BLOCK_143\n\n\n\nCODE_BLOCK_144\n\nPython\n\n\nCODE_BLOCK_145\n\nCODE_BLOCK_146\n\n\nPython-asyncio\n\n\nCODE_BLOCK_147\n\nCODE_BLOCK_148\n\n\njavascript\n\n\nCODE_BLOCK_149\n\nCODE_BLOCK_150\n\njava\n\n\nCODE_BLOCK_151\n\nCODE_BLOCK_152\n\n\nC#\n\n\nCODE_BLOCK_153\n\nCODE_BLOCK_154\n\n\nRust\n\n\nCODE_BLOCK_155\n\nCODE_BLOCK_156\n\n\nTypeScript\n\n\nCODE_BLOCK_157\n\nCODE_BLOCK_158\n\n\nGo\n\n\nCODE_BLOCK_159\n\nCODE_BLOCK_160\n\n\n\n\u5728\u4e0a\u4e00\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u9ed8\u8ba4\u7684 **\u7a00\u758f** \u6a21\u5f0f\u3002\u4e3a\u4e86\u6f14\u793a **\u5206\u7247** \u6a21\u5f0f\uff0c\u8ba9\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u75312\u4e2a\u672c\u5730PQ\u8868\u7ec4\u6210\u7684\u5206\u5e03\u5f0fPQ\u8868\uff0c\u5e76\u5411\u201cproducts1\u201d\u6dfb\u52a02\u4e2a\u6587\u6863\uff0c\u5411\u201cproducts2\u201d\u6dfb\u52a01\u4e2a\u6587\u6863\uff1a\nCODE_BLOCK_161\n\n\n\u73b0\u5728\uff0c\u5982\u679c\u60a8\u5728 `CALL PQ` \u4e2d\u6dfb\u52a0 `'sharded' as mode`\uff0c\u5b83\u5c06\u628a\u6587\u6863\u53d1\u9001\u5230\u6240\u6709\u4ee3\u7406\u7684\u8868\uff08\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4ec5\u672c\u5730\u8868\uff0c\u4f46\u5b83\u4eec\u53ef\u4ee5\u662f\u8fdc\u7a0b\u7684\u4ee5\u5229\u7528\u5916\u90e8\u786c\u4ef6\uff09\u3002\u6b64\u6a21\u5f0f\u65e0\u6cd5\u901a\u8fc7JSON\u63a5\u53e3\u4f7f\u7528\u3002\n\n\nSQL:\n\n\nCODE_BLOCK_162\n\n\nCODE_BLOCK_163\n\n\n\n\u8bf7\u6ce8\u610f\uff0c\u914d\u7f6e\u4e2d\u4ee3\u7406\u955c\u50cf\u7684\u8bed\u6cd5\uff08\u5f53\u591a\u4e2a\u4e3b\u673a\u5206\u914d\u7ed9\u4e00\u4e2a `agent` \u884c\u65f6\uff0c\u7528 `|` \u5206\u9694\uff09\u4e0e `CALL PQ` \u67e5\u8be2\u6a21\u5f0f\u65e0\u5173\u3002\u6bcf\u4e2a `agent` \u59cb\u7ec8\u4ee3\u8868 **\u4e00\u4e2a** \u8282\u70b9\uff0c\u65e0\u8bba\u4e3a\u8be5\u4ee3\u7406\u6307\u5b9a\u4e86\u591a\u5c11\u4e2aHA\u955c\u50cf\u3002\n\n\n##### \u6211\u5982\u4f55\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u6027\u80fd\u7684\u4fe1\u606f\uff1f\n\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u60a8\u53ef\u80fd\u5e0c\u671b\u83b7\u53d6\u6709\u5173\u6e17\u900f\u67e5\u8be2\u6027\u80fd\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\u4e3a\u6b64\uff0c\u6709\u9009\u9879 `1 as verbose`\uff0c\u8be5\u9009\u9879\u4ec5\u901a\u8fc7SQL\u53ef\u7528\uff0c\u5e76\u5141\u8bb8\u60a8\u4fdd\u5b58\u66f4\u591a\u6027\u80fd\u6307\u6807\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 `SHOW META` \u67e5\u8be2\u67e5\u770b\u5b83\u4eec\uff0c\u60a8\u53ef\u4ee5\u5728 `CALL PQ` \u4e4b\u540e\u8fd0\u884c\u8be5\u67e5\u8be2\u3002\u6709\u5173\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1 [SHOW META](../Node_info_and_management/SHOW_META.md)\u3002\n\n\n1 as verbose:\n\n\nCODE_BLOCK_164\n\n\nCODE_BLOCK_165\n\n0 as verbose (default):\n\n\nCODE_BLOCK_166\n\n\nCODE_BLOCK_167\n\n", "russian": "\n\n##### \u042f \u0445\u043e\u0447\u0443 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c percolate-\u0437\u0430\u043f\u0440\u043e\u0441\u0430\nPercolate-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0451\u043c\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0442\u043e\u0431\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435.\n\n\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0430 \u0440\u0435\u0436\u0438\u043c\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f percolate-\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u043a\u0430\u043a percolate-\u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u0439:\n\n* **Sparse (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e).** \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f: \u043c\u043d\u043e\u0433\u0438\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u044b\u0445 PQ \u0442\u0430\u0431\u043b\u0438\u0446. \u041a\u043e\u0433\u0434\u0430 \u0432\u0430\u0448 \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u043d\u043e \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0445\u0441\u044f \u0432 PQ-\u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0440\u0435\u0436\u0438\u043c sparse \u043f\u043e\u043b\u0435\u0437\u0435\u043d. \u0412 \u044d\u0442\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u043f\u0430\u043a\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0435, \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0430\u0433\u0435\u043d\u0442\u043e\u0432, \u0442\u0430\u043a \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0437\u0435\u043b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u0432\u0430\u0448\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430. Manticore \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u0430\u0448 \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u0443\u0441\u043a\u0438 \u043c\u0435\u0436\u0434\u0443 \u0437\u0435\u0440\u043a\u0430\u043b\u0430\u043c\u0438. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0433\u0435\u043d\u0442\u044b \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, Manticore \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0442\u0430\u043a, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u043e\u043d \u043f\u0440\u0438\u0448\u0451\u043b \u043e\u0442 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0414\u043b\u044f \u043f\u043e\u043c\u043e\u0449\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 [\u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044e](../References.md#Replication).\n* **Sharded.** \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f: \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b PQ, \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 PQ-\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438. \u0412 \u044d\u0442\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0432\u0435\u0441\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 PQ-\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0435\u0437 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u042d\u0442\u043e \u0432\u044b\u0433\u043e\u0434\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043d\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0445\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u0435\u043b\u0438\u043a\u043e. \u0422\u043e\u0433\u0434\u0430 \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b PQ \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0437\u043b\u0435 \u0438 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u0435 \u0443\u0437\u043b\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u043e\u0442\u0438\u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u043f\u0440\u0430\u0432\u0438\u043b PQ. \u042d\u0442\u043e\u0442 \u0440\u0435\u0436\u0438\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u044f\u0432\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0441\u0435\u0442\u044c \u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 PQ, \u0447\u0442\u043e [\u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f](../References.md#Replication) \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438.\n\n\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430 `pq_d2`, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u0430\u044f \u043a\u0430\u043a:\n\nCODE_BLOCK_114\n\n\n\u041a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 'pq' \u0438 'ptitle' \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442:\n\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_115\n\n\n\nCODE_BLOCK_116\n\n\n\nCODE_BLOCK_117\n\n\n\nCODE_BLOCK_118\n\n\n\nCODE_BLOCK_119\n\n\n\nCODE_BLOCK_120\n\nPython\n\n\nCODE_BLOCK_121\n\nCODE_BLOCK_122\n\n\nPython-asyncio\n\n\nCODE_BLOCK_123\n\nCODE_BLOCK_124\n\n\njavascript\n\n\nCODE_BLOCK_125\n\nCODE_BLOCK_126\n\njavascript\n\n\nCODE_BLOCK_127\n\nCODE_BLOCK_128\n\n\njava\n\n\nCODE_BLOCK_129\n\nCODE_BLOCK_130\n\n\nC#\n\n\nCODE_BLOCK_131\n\nCODE_BLOCK_132\n\n\nRust\n\n\nCODE_BLOCK_133\n\nCODE_BLOCK_134\n\n\nTypeScript\n\n\nCODE_BLOCK_135\n\nCODE_BLOCK_136\n\n\nGo\n\n\nCODE_BLOCK_137\n\nCODE_BLOCK_138\n\n\n\n\n\n\n\u0418 \u0432\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0435 `CALL PQ` \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438.\n\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_139\n\n\n\nCODE_BLOCK_140\n\n\n\nCODE_BLOCK_141\n\n\n\nCODE_BLOCK_142\n\n\n\nCODE_BLOCK_143\n\n\n\nCODE_BLOCK_144\n\nPython\n\n\nCODE_BLOCK_145\n\nCODE_BLOCK_146\n\n\nPython-asyncio\n\n\nCODE_BLOCK_147\n\nCODE_BLOCK_148\n\n\njavascript\n\n\nCODE_BLOCK_149\n\nCODE_BLOCK_150\n\njava\n\n\nCODE_BLOCK_151\n\nCODE_BLOCK_152\n\n\nC#\n\n\nCODE_BLOCK_153\n\n\nCODE_BLOCK_154\n\n\nRust\n\n\nCODE_BLOCK_155\n\n\nCODE_BLOCK_156\n\n\nTypeScript\n\n\nCODE_BLOCK_157\n\n\nCODE_BLOCK_158\n\n\nGo\n\n\nCODE_BLOCK_159\n\n\nCODE_BLOCK_160\n\n\n\n\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0440\u0435\u0436\u0438\u043c **sparse** \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0436\u0438\u043c **sharded**, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u0443\u044e PQ-\u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0437 2 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 PQ-\u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c 2 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \"products1\" \u0438 1 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0432 \"products2\":\nCODE_BLOCK_161\n\n\n\u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c `'sharded' as mode` \u043a `CALL PQ`, \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u0432\u043e \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0430\u0433\u0435\u043d\u0442\u0430 (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u043e \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f). \u042d\u0442\u043e\u0442 \u0440\u0435\u0436\u0438\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0447\u0435\u0440\u0435\u0437 JSON-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.\n\n\nSQL:\n\n\nCODE_BLOCK_162\n\n\nCODE_BLOCK_163\n\n\n\n\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0437\u0435\u0440\u043a\u0430\u043b \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 (\u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0441\u0442\u043e\u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 `agent` \u0447\u0435\u0440\u0435\u0437 `|`) \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043a \u0440\u0435\u0436\u0438\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 `CALL PQ`. \u041a\u0430\u0436\u0434\u044b\u0439 `agent` \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 **\u043e\u0434\u0438\u043d** \u0443\u0437\u0435\u043b, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0437\u0435\u0440\u043a\u0430\u043b HA \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430.\n\n\n##### \u041a\u0430\u043a \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438?\n\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0435\u0439 \u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 percolate-\u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u043f\u0446\u0438\u044f `1 as verbose`, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 SQL, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043c\u0435\u0442\u0440\u0438\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 `SHOW META`, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 `CALL PQ`. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441\u043c. \u0432 [SHOW META](../Node_info_and_management/SHOW_META.md).\n\n\n1 as verbose:\n\n\nCODE_BLOCK_164\n\n\nCODE_BLOCK_165\n\n0 as verbose (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e):\n\n\nCODE_BLOCK_166\n\n\nCODE_BLOCK_167\n\n\n\n" }, "is_code_or_comment": false, "model": "openai:gpt-4.1-mini", "updated_at": 1766339926 }, "5489eca01b41b3d76fffb733c0dc65f584ab734552c26ba50d45cf1908803c74": { "original": "# Percolate Query\n\nPercolate queries are also known as Persistent queries, Prospective search, document routing, search in reverse, and inverse search.\n\nThe traditional way of conducting searches involves storing documents and performing search queries against them. However, there are cases where we want to apply a query to a newly incoming document to signal a match. Some scenarios where this is desired include monitoring systems that collect data and notify users about specific events, such as reaching a certain threshold for a metric or a particular value appearing in the monitored data. Another example is news aggregation, where users may want to be notified only about certain categories or topics, or even specific \"keywords.\"\n\nIn these situations, traditional search is not the best fit, as it assumes the desired search is performed over the entire collection. This process gets multiplied by the number of users, resulting in many queries running over the entire collection, which can cause significant additional load. The alternative approach described in this section involves storing the queries instead and testing them against an incoming new document or a batch of documents.\n\nGoogle Alerts, AlertHN, Bloomberg Terminal, and other systems that allow users to subscribe to specific content utilize similar technology.\n\n> * See [percolate](../Creating_a_table/Local_tables/Percolate_table.md) for information on creating a PQ table.\n> * See [Adding rules to a percolate table](../Data_creation_and_modification/Adding_documents_to_a_table/Adding_rules_to_a_percolate_table.md) to learn how to add percolate rules (also known as PQ rules). Here's a quick example:\n\n\n### Performing a percolate query with CALL PQ\n\nThe key thing to remember about percolate queries is that your search queries are already in the table. What you need to provide are documents **to check if any of them match any of the stored rules**.\n\nYou can perform a percolate query via SQL or JSON interfaces, as well as using programming language clients. The SQL approach offers more flexibility, while the HTTP method is simpler and provides most of what you need. The table below can help you understand the differences.\n\n| Desired Behavior | SQL | HTTP |\n| ----------------------------- | --------------------------------------- | ------------------------------------ |\n| Provide a single document | `CALL PQ('tbl', '{doc1}')` | `query.percolate.document{doc1}` |\n| Provide a single document (alternative) | `CALL PQ('tbl', 'doc1', 0 as docs_json)` | - |\n| Provide multiple documents | `CALL PQ('tbl', ('doc1', 'doc2'), 0 as docs_json)` | - |\n| Provide multiple documents (alternative) | `CALL PQ('tbl', ('{doc1}', '{doc2}'))` | - |\n| Provide multiple documents (alternative) | `CALL PQ('tbl', '[{doc1}, {doc2}]')` | - |\n| Return matching document ids | 0/1 as docs (disabled by default) | Enabled by default |\n| Use document's own id to show in the result | 'id field' as docs_id (disabled by default) | Not available |\n| Consider input documents are JSON | 1 as docs_json (1 by default) | Enabled by default |\n| Consider input documents are plain text | 0 as docs_json (1 by default) | Not available |\n| [Sparsed distribution mode](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | default | default |\n| [Sharded distribution mode](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | sharded as mode | Not available |\n| Return all info about matching query | 1 as query (0 by default) | Enabled by default |\n| Skip invalid JSON | 1 as skip_bad_json (0 by default) | Not available |\n| Extended info in [SHOW META](../Node_info_and_management/SHOW_META.md) | 1 as verbose (0 by default) | Not available |\n| Define the number which will be added to document ids if no docs_id fields provided (mostly relevant in [distributed PQ modes](../Creating_a_table/Creating_a_distributed_table/Remote_tables.md#Distributed-percolate-tables-%28DPQ-tables%29)) | 1 as shift (0 by default) | Not available |\n\n\nTo demonstrate how this works, here are a few examples. Let's create a PQ table with two fields:\n\n* title (text)\n* color (string)\n\nand three rules in it:\n\n* Just full-text. Query: `@title bag`\n* Full-text and filtering. Query: `@title shoes`. Filters: `color='red'`\n* Full-text and more complex filtering. Query: `@title shoes`. Filters: `color IN('blue', 'green')`\n\n\n#### SQL\n\n\nCODE_BLOCK_0\n\n\n\nCODE_BLOCK_1\n\n\n\nCODE_BLOCK_2\n\n\n#### JSON\n\n\nCODE_BLOCK_3\n\n\n#### PHP\n\n\nCODE_BLOCK_4\n\nCODE_BLOCK_5\n\nPython\n\n\nCODE_BLOCK_6\n\nCODE_BLOCK_7\n\n\nPython-asyncio\n\n\nCODE_BLOCK_8\n\nCODE_BLOCK_9\n\n\njavascript\n\n\nCODE_BLOCK_10\n\nCODE_BLOCK_11\n\njava\n\n\nCODE_BLOCK_12\n\nCODE_BLOCK_13\n\n\nC#\n\n\nCODE_BLOCK_14\n\nCODE_BLOCK_15\n\n\nRust\n\n\nCODE_BLOCK_16\n\nCODE_BLOCK_17\n\n\nTypeScript\n\nCODE_BLOCK_18\n\nCODE_BLOCK_19\n\n\nGo\n\nCODE_BLOCK_20\n\nCODE_BLOCK_21\n\n\n\n\n##### Just tell me what PQ rules match my single document\n\nThe first document doesn't match any rules. It could match the first two, but they require additional filters.\n\nThe second document matches one rule. Note that CALL PQ by default expects a document to be a JSON, but if you use `0 as docs_json`, you can pass a plain string instead.\n\n\nSQL:\n\n\nCODE_BLOCK_22\n", "translations": { "chinese": "```markdown\n# \u6e17\u900f\u67e5\u8be2\n\n\u6e17\u900f\u67e5\u8be2\u4e5f\u88ab\u79f0\u4e3a\u6301\u4e45\u67e5\u8be2\u3001\u524d\u77bb\u6027\u641c\u7d22\u3001\u6587\u6863\u8def\u7531\u3001\u53cd\u5411\u641c\u7d22\u548c\u9006\u5411\u641c\u7d22\u3002\n\n\u4f20\u7edf\u7684\u641c\u7d22\u65b9\u5f0f\u662f\u5b58\u50a8\u6587\u6863\u5e76\u5bf9\u5176\u6267\u884c\u641c\u7d22\u67e5\u8be2\u3002\u7136\u800c\uff0c\u6709\u4e9b\u60c5\u51b5\u4e0b\u6211\u4eec\u5e0c\u671b\u5c06\u67e5\u8be2\u5e94\u7528\u4e8e\u65b0\u5230\u7684\u6587\u6863\u4ee5\u6807\u8bc6\u5339\u914d\u3002\u4e00\u4e9b\u9700\u8981\u8fd9\u79cd\u65b9\u5f0f\u7684\u573a\u666f\u5305\u62ec\u76d1\u63a7\u7cfb\u7edf\uff0c\u8fd9\u4e9b\u7cfb\u7edf\u6536\u96c6\u6570\u636e\u5e76\u901a\u77e5\u7528\u6237\u7279\u5b9a\u4e8b\u4ef6\uff0c\u4f8b\u5982\u8fbe\u5230\u67d0\u4e2a\u6307\u6807\u7684\u9608\u503c\u6216\u76d1\u63a7\u6570\u636e\u4e2d\u51fa\u73b0\u7279\u5b9a\u503c\u3002\u53e6\u4e00\u4e2a\u4f8b\u5b50\u662f\u65b0\u95fb\u805a\u5408\uff0c\u7528\u6237\u53ef\u80fd\u53ea\u5e0c\u671b\u6536\u5230\u5173\u4e8e\u67d0\u4e9b\u7c7b\u522b\u6216\u4e3b\u9898\uff0c\u751a\u81f3\u7279\u5b9a\u201c\u5173\u952e\u8bcd\u201d\u7684\u901a\u77e5\u3002\n\n\u5728\u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f20\u7edf\u641c\u7d22\u5e76\u4e0d\u662f\u6700\u4f73\u9009\u62e9\uff0c\u56e0\u4e3a\u5b83\u5047\u8bbe\u6240\u9700\u7684\u641c\u7d22\u662f\u5728\u6574\u4e2a\u96c6\u5408\u4e0a\u6267\u884c\u7684\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u4f1a\u56e0\u7528\u6237\u6570\u91cf\u800c\u500d\u589e\uff0c\u5bfc\u81f4\u8bb8\u591a\u67e5\u8be2\u5728\u6574\u4e2a\u96c6\u5408\u4e0a\u8fd0\u884c\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u663e\u8457\u7684\u989d\u5916\u8d1f\u8f7d\u3002\u672c\u8282\u63cf\u8ff0\u7684\u66ff\u4ee3\u65b9\u6cd5\u662f\u5b58\u50a8\u67e5\u8be2\uff0c\u5e76\u5c06\u5176\u4e0e\u65b0\u5230\u7684\u6587\u6863\u6216\u4e00\u6279\u6587\u6863\u8fdb\u884c\u6d4b\u8bd5\u3002\n\nGoogle Alerts\u3001AlertHN\u3001Bloomberg Terminal \u548c\u5176\u4ed6\u5141\u8bb8\u7528\u6237\u8ba2\u9605\u7279\u5b9a\u5185\u5bb9\u7684\u7cfb\u7edf\u4f7f\u7528\u4e86\u7c7b\u4f3c\u7684\u6280\u672f\u3002\n\n> * \u8bf7\u53c2\u9605 [percolate](../Creating_a_table/Local_tables/Percolate_table.md) \u4ee5\u83b7\u53d6\u6709\u5173\u521b\u5efa PQ \u8868\u7684\u4fe1\u606f\u3002\n> * \u8bf7\u53c2\u9605 [Adding rules to a percolate table](../Data_creation_and_modification/Adding_documents_to_a_table/Adding_rules_to_a_percolate_table.md) \u4ee5\u4e86\u89e3\u5982\u4f55\u6dfb\u52a0\u6e17\u900f\u89c4\u5219\uff08\u4e5f\u79f0\u4e3a PQ \u89c4\u5219\uff09\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5feb\u901f\u793a\u4f8b\uff1a\n\n### \u4f7f\u7528 CALL PQ \u6267\u884c\u6e17\u900f\u67e5\u8be2\n\n\u5173\u4e8e\u6e17\u900f\u67e5\u8be2\u9700\u8981\u8bb0\u4f4f\u7684\u5173\u952e\u70b9\u662f\uff0c\u60a8\u7684\u641c\u7d22\u67e5\u8be2\u5df2\u7ecf\u5728\u8868\u4e2d\u3002\u60a8\u9700\u8981\u63d0\u4f9b\u7684\u662f\u6587\u6863**\u4ee5\u68c0\u67e5\u5b83\u4eec\u4e2d\u7684\u4efb\u4f55\u4e00\u4e2a\u662f\u5426\u5339\u914d\u4efb\u4f55\u5b58\u50a8\u7684\u89c4\u5219**\u3002\n\n\u60a8\u53ef\u4ee5\u901a\u8fc7 SQL \u6216 JSON \u63a5\u53e3\u6267\u884c\u6e17\u900f\u67e5\u8be2\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u5ba2\u6237\u7aef\u3002SQL \u65b9\u6cd5\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u7075\u6d3b\u6027\uff0c\u800c HTTP \u65b9\u6cd5\u66f4\u7b80\u5355\u5e76\u63d0\u4f9b\u4e86\u5927\u90e8\u5206\u6240\u9700\u529f\u80fd\u3002\u4e0b\u8868\u53ef\u4ee5\u5e2e\u52a9\u60a8\u7406\u89e3\u5dee\u5f02\u3002\n\n| \u6240\u9700\u884c\u4e3a | SQL | HTTP |\n| ----------------------------- | --------------------------------------- | ------------------------------------ |\n| \u63d0\u4f9b\u5355\u4e2a\u6587\u6863 | `CALL PQ('tbl', '{doc1}')` | `query.percolate.document{doc1}` |\n| \u63d0\u4f9b\u5355\u4e2a\u6587\u6863\uff08\u66ff\u4ee3\uff09 | `CALL PQ('tbl', 'doc1', 0 as docs_json)` | - |\n| \u63d0\u4f9b\u591a\u4e2a\u6587\u6863 | `CALL PQ('tbl', ('doc1', 'doc2'), 0 as docs_json)` | - |\n| \u63d0\u4f9b\u591a\u4e2a\u6587\u6863\uff08\u66ff\u4ee3\uff09 | `CALL PQ('tbl', ('{doc1}', '{doc2}'))` | - |\n| \u63d0\u4f9b\u591a\u4e2a\u6587\u6863\uff08\u66ff\u4ee3\uff09 | `CALL PQ('tbl', '[{doc1}, {doc2}]')` | - |\n| \u8fd4\u56de\u5339\u914d\u7684\u6587\u6863 ID | 0/1 as docs (\u9ed8\u8ba4\u7981\u7528) | \u9ed8\u8ba4\u542f\u7528 |\n| \u4f7f\u7528\u6587\u6863\u81ea\u8eab\u7684 ID \u663e\u793a\u5728\u7ed3\u679c\u4e2d | 'id field' as docs_id (\u9ed8\u8ba4\u7981\u7528) | \u4e0d\u53ef\u7528 |\n| \u5c06\u8f93\u5165\u6587\u6863\u89c6\u4e3a JSON | 1 as docs_json (\u9ed8\u8ba4 1) | \u9ed8\u8ba4\u542f\u7528 |\n| \u5c06\u8f93\u5165\u6587\u6863\u89c6\u4e3a\u7eaf\u6587\u672c | 0 as docs_json (\u9ed8\u8ba4 1) | \u4e0d\u53ef\u7528 |\n| [\u7a00\u758f\u5206\u5e03\u6a21\u5f0f](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | \u9ed8\u8ba4 | \u9ed8\u8ba4 |\n| [\u5206\u7247\u5206\u5e03\u6a21\u5f0f](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | sharded as mode | \u4e0d\u53ef\u7528 |\n| \u8fd4\u56de\u5339\u914d\u67e5\u8be2\u7684\u6240\u6709\u4fe1\u606f | 1 as query (\u9ed8\u8ba4 0) | \u9ed8\u8ba4\u542f\u7528 |\n| \u8df3\u8fc7\u65e0\u6548\u7684 JSON | 1 as skip_bad_json (\u9ed8\u8ba4 0) | \u4e0d\u53ef\u7528 |\n| \u5728 [SHOW META](../Node_info_and_management/SHOW_META.md) \u4e2d\u6269\u5c55\u4fe1\u606f | 1 as verbose (\u9ed8\u8ba4 0) | \u4e0d\u53ef\u7528 |\n| \u5b9a\u4e49\u5c06\u5728\u6ca1\u6709\u63d0\u4f9b docs_id \u5b57\u6bb5\u65f6\u6dfb\u52a0\u5230\u6587\u6863 ID \u7684\u6570\u5b57\uff08\u4e3b\u8981\u5728 [\u5206\u5e03\u5f0f PQ \u6a21\u5f0f](../Creating_a_table/Creating_a_distributed_table/Remote_tables.md#Distributed-percolate-tables-%28DPQ-tables%29) \u4e2d\u76f8\u5173\uff09 | 1 as shift (\u9ed8\u8ba4 0) | \u4e0d\u53ef\u7528 |\n\n\n\u4e3a\u4e86\u6f14\u793a\u5176\u5de5\u4f5c\u539f\u7406\uff0c\u8fd9\u91cc\u6709\u4e00\u4e9b\u793a\u4f8b\u3002\u8ba9\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u4e24\u4e2a\u5b57\u6bb5\u7684 PQ \u8868\uff1a\n\n* title (\u6587\u672c)\n* color (\u5b57\u7b26\u4e32)\n\n\u4ee5\u53ca\u5176\u4e2d\u7684\u4e09\u4e2a\u89c4\u5219\uff1a\n\n* \u4ec5\u5168\u6587\u3002\u67e5\u8be2\uff1a`@title bag`\n* \u5168\u6587\u548c\u8fc7\u6ee4\u3002\u67e5\u8be2\uff1a`@title shoes`\u3002\u8fc7\u6ee4\u5668\uff1a`color='red'`\n* \u5168\u6587\u548c\u66f4\u590d\u6742\u7684\u8fc7\u6ee4\u3002\u67e5\u8be2\uff1a`@title shoes`\u3002\u8fc7\u6ee4\u5668\uff1a`color IN('blue', 'green')`\n\n\n#### SQL\n\n\nCODE_BLOCK_0\n\n\n\nCODE_BLOCK_1\n\n\n\nCODE_BLOCK_2\n\n\n#### JSON\n\n\nCODE_BLOCK_3\n\n\n#### PHP\n\n\nCODE_BLOCK_4\n\nCODE_BLOCK_5\n\nPython\n\n\nCODE_BLOCK_6\n\nCODE_BLOCK_7\n\n\nPython-asyncio\n\n\nCODE_BLOCK_8\n\nCODE_BLOCK_9\n\n\njavascript\n\n\nCODE_BLOCK_10\n\nCODE_BLOCK_11\n\njava\n\n\nCODE_BLOCK_12\n\nCODE_BLOCK_13\n\n\nC#\n\n\nCODE_BLOCK_14\n\nCODE_BLOCK_15\n\n\nRust\n\n\nCODE_BLOCK_16\n\nCODE_BLOCK_17\n\n\nTypeScript\n\nCODE_BLOCK_18\n\nCODE_BLOCK_19\n\n\nGo\n\nCODE_BLOCK_20\n\nCODE_BLOCK_21\n\n\n\n\n##### \u53ea\u544a\u8bc9\u6211\u54ea\u4e9b PQ \u89c4\u5219\u5339\u914d\u6211\u7684\u5355\u4e2a\u6587\u6863\n\n\u7b2c\u4e00\u4e2a\u6587\u6863\u4e0d\u5339\u914d\u4efb\u4f55\u89c4\u5219\u3002\u5b83\u53ef\u80fd\u5339\u914d\u524d\u4e24\u4e2a\uff0c\u4f46\u5b83\u4eec\u9700\u8981\u989d\u5916\u7684\u8fc7\u6ee4\u5668\u3002\n\n\u7b2c\u4e8c\u4e2a\u6587\u6863\u5339\u914d\u4e00\u4e2a\u89c4\u5219\u3002\u8bf7\u6ce8\u610f\uff0cCALL PQ \u9ed8\u8ba4\u671f\u671b\u6587\u6863\u662f JSON\uff0c\u4f46\u5982\u679c\u60a8\u4f7f\u7528 `0 as docs_json`\uff0c\u5219\u53ef\u4ee5\u4f20\u9012\u7eaf\u5b57\u7b26\u4e32\u3002\n\n\nSQL:\n\n\nCODE_BLOCK_22\n\n```", "russian": "# \u041f\u0435\u0440\u043a\u043e\u043b\u044f\u0442\u043e\u0440\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\n\n\u041f\u0435\u0440\u043a\u043e\u043b\u044f\u0442\u043e\u0440\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u043a\u0430\u043a \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a, \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u043e\u0438\u0441\u043a \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a.\n\n\u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u043e\u0432 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043d\u0438\u043c. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0432\u043d\u043e\u0432\u044c \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0435\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u0445, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u043e\u0433\u0430 \u0434\u043b\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u2014 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0441\u0442\u0435\u0439, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0445\u043e\u0442\u0435\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u0445 \u0438\u043b\u0438 \u0442\u0435\u043c\u0430\u0445, \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \"\u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432\u0430\u0445\".\n\n\u0412 \u044d\u0442\u0438\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442, \u0447\u0442\u043e \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0432\u0441\u0435\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u043f\u043e \u0432\u0441\u0435\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443. \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435, \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0438\u0445 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430 \u043d\u043e\u0432\u043e\u043c \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0435\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u0438\u043b\u0438 \u043f\u0430\u0440\u0442\u0438\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432.\n\nGoogle Alerts, AlertHN, Bloomberg Terminal \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e.\n\n> * \u0421\u043c. [\u043f\u0435\u0440\u043a\u043e\u043b\u044f\u0442\u043e\u0440](../Creating_a_table/Local_tables/Percolate_table.md) \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b PQ.\n> * \u0421\u043c. [\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043f\u0435\u0440\u043a\u043e\u043b\u044f\u0442\u043e\u0440\u043e\u0432](../Data_creation_and_modification/Adding_documents_to_a_table/Adding_rules_to_a_percolate_table.md), \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0435\u0440\u043a\u043e\u043b\u044f\u0442\u043e\u0440\u043e\u0432 (\u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u0430 PQ). \u0412\u043e\u0442 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:\n\n\n### \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u043a\u043e\u043b\u044f\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e CALL PQ\n\n\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043e \u043f\u0435\u0440\u043a\u043e\u043b\u044f\u0442\u043e\u0440\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445, \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0432\u0430\u0448\u0438 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0443\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u0427\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0442\u0430\u043a \u044d\u0442\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b **\u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u043b\u0438 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0438\u0437 \u043d\u0438\u0445 \u0441 \u043b\u044e\u0431\u044b\u043c \u0438\u0437 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b**.\n\n\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0435\u0440\u043a\u043e\u043b\u044f\u0442\u043e\u0440\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0447\u0435\u0440\u0435\u0437 SQL \u0438\u043b\u0438 JSON \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u043e\u0434\u0445\u043e\u0434 SQL \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043c\u0435\u0442\u043e\u0434 HTTP \u043f\u0440\u043e\u0449\u0435 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0432\u0430\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u043d\u0438\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c \u043f\u043e\u043d\u044f\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f.\n\n| \u0416\u0435\u043b\u0430\u0435\u043c\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 | SQL | HTTP |\n| ----------------------------- | --------------------------------------- | ------------------------------------ |\n| \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 | `CALL PQ('tbl', '{doc1}')` | `query.percolate.document{doc1}` |\n| \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 (\u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430) | `CALL PQ('tbl', 'doc1', 0 as docs_json)` | - |\n| \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 | `CALL PQ('tbl', ('doc1', 'doc2'), 0 as docs_json)` | - |\n| \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430) | `CALL PQ('tbl', ('{doc1}', '{doc2}'))` | - |\n| \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430) | `CALL PQ('tbl', '[{doc1}, {doc2}]')` | - |\n| \u0412\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 | 0/1 as docs (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e) | \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e |\n| \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 | 'id field' as docs_id (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e) | \u041d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e |\n| \u0420\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u0430\u043a JSON | 1 as docs_json (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 1) | \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e |\n| \u0420\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0435\u043a\u0441\u0442 | 0 as docs_json (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 1) | \u041d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e |\n| [\u0420\u0435\u0436\u0438\u043c \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e | \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e |\n| [\u0420\u0435\u0436\u0438\u043c \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | sharded as mode | \u041d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e |\n| \u0412\u0435\u0440\u043d\u0443\u0442\u044c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 | 1 as query (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 0) | \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e |\n| \u041f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 JSON | 1 as skip_bad_json (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 0) | \u041d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e |\n| \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432 [SHOW META](../Node_info_and_management/SHOW_META.md) | 1 as verbose (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 0) | \u041d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e |\n| \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u043a \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044f docs_id \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b (\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0432 [\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0436\u0438\u043c\u0430\u0445 PQ](../Creating_a_table/Creating_a_distributed_table/Remote_tables.md#Distributed-percolate-tables-%28DPQ-tables%29)) | 1 as shift (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 0) | \u041d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e |\n\n\n\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0432\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 PQ \u0441 \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u043b\u044f\u043c\u0438:\n\n* title (\u0442\u0435\u043a\u0441\u0442)\n* color (\u0441\u0442\u0440\u043e\u043a\u0430)\n\n\u0438 \u0442\u0440\u0435\u043c\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u0432 \u043d\u0435\u0439:\n\n* \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442. \u0417\u0430\u043f\u0440\u043e\u0441: `@title bag`\n* \u041f\u043e\u043b\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f. \u0417\u0430\u043f\u0440\u043e\u0441: `@title shoes`. \u0424\u0438\u043b\u044c\u0442\u0440\u044b: `color='red'`\n* \u041f\u043e\u043b\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f. \u0417\u0430\u043f\u0440\u043e\u0441: `@title shoes`. \u0424\u0438\u043b\u044c\u0442\u0440\u044b: `color IN('blue', 'green')`\n\n\n#### SQL\n\n\nCODE_BLOCK_0\n\n\n\nCODE_BLOCK_1\n\n\n\nCODE_BLOCK_2\n\n\n#### JSON\n\n\nCODE_BLOCK_3\n\n\n#### PHP\n\n\nCODE_BLOCK_4\n\nCODE_BLOCK_5\n\nPython\n\n\nCODE_BLOCK_6\n\nCODE_BLOCK_7\n\n\nPython-asyncio\n\n\nCODE_BLOCK_8\n\nCODE_BLOCK_9\n\n\njavascript\n\n\nCODE_BLOCK_10\n\nCODE_BLOCK_11\n\njava\n\n\nCODE_BLOCK_12\n\nCODE_BLOCK_13\n\n\nC#\n\n\nCODE_BLOCK_14\n\nCODE_BLOCK_15\n\n\nRust\n\n\nCODE_BLOCK_16\n\nCODE_BLOCK_17\n\n\nTypeScript\n\nCODE_BLOCK_18\n\nCODE_BLOCK_19\n\n\nGo\n\nCODE_BLOCK_20\n\nCODE_BLOCK_21\n\n\n\n\n##### \u041f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u0430\u0436\u0438\u0442\u0435 \u043c\u043d\u0435, \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 PQ \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043c\u043e\u0435\u043c\u0443 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443\n\n\u041f\u0435\u0440\u0432\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c. \u041e\u043d \u043c\u043e\u0433 \u0431\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0432\u0443\u043c, \u043d\u043e \u043e\u043d\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432.\n\n\u0412\u0442\u043e\u0440\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e CALL PQ \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0436\u0438\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 `0 as docs_json`, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e.\n\n\nSQL:\n\n\nCODE_BLOCK_22\n" }, "is_code_or_comment": false, "model": "openai:gpt-4o-mini", "updated_at": 1766339958 }, "d13647389fc0dbfb2d1b86ead17fc4679dc45bf2ea718ab0107acdb4e2f8de03": { "original": "# Percolate Query\n\nPercolate queries are also known as Persistent queries, Prospective search, document routing, search in reverse, and inverse search.\n\nThe traditional way of conducting searches involves storing documents and performing search queries against them. However, there are cases where we want to apply a query to a newly incoming document to signal a match. Some scenarios where this is desired include monitoring systems that collect data and notify users about specific events, such as reaching a certain threshold for a metric or a particular value appearing in the monitored data. Another example is news aggregation, where users may want to be notified only about certain categories or topics, or even specific \"keywords.\"\n\nIn these situations, traditional search is not the best fit, as it assumes the desired search is performed over the entire collection. This process gets multiplied by the number of users, resulting in many queries running over the entire collection, which can cause significant additional load. The alternative approach described in this section involves storing the queries instead and testing them against an incoming new document or a batch of documents.\n\nGoogle Alerts, AlertHN, Bloomberg Terminal, and other systems that allow users to subscribe to specific content utilize similar technology.\n\n> * See [percolate](../Creating_a_table/Local_tables/Percolate_table.md) for information on creating a PQ table.\n> * See [Adding rules to a percolate table](../Data_creation_and_modification/Adding_documents_to_a_table/Adding_rules_to_a_percolate_table.md) to learn how to add percolate rules (also known as PQ rules). Here's a quick example:\n\n### Performing a percolate query with CALL PQ\n\nThe key thing to remember about percolate queries is that your search queries are already in the table. What you need to provide are documents **to check if any of them match any of the stored rules**.\n\nYou can perform a percolate query via SQL or JSON interfaces, as well as using programming language clients. The SQL approach offers more flexibility, while the HTTP method is simpler and provides most of what you need. The table below can help you understand the differences.\n\n| Desired Behavior | SQL | HTTP |\n| ----------------------------- | --------------------------------------- | ------------------------------------ |\n| Provide a single document | `CALL PQ('tbl', '{doc1}')` | `query.percolate.document{doc1}` |\n| Provide a single document (alternative) | `CALL PQ('tbl', 'doc1', 0 as docs_json)` | - |\n| Provide multiple documents | `CALL PQ('tbl', ('doc1', 'doc2'), 0 as docs_json)` | - |\n| Provide multiple documents (alternative) | `CALL PQ('tbl', ('{doc1}', '{doc2}'))` | - |\n| Provide multiple documents (alternative) | `CALL PQ('tbl', '[{doc1}, {doc2}]')` | - |\n| Return matching document ids | 0/1 as docs (disabled by default) | Enabled by default |\n| Use document's own id to show in the result | 'id field' as docs_id (disabled by default) | Not available |\n| Consider input documents are JSON | 1 as docs_json (1 by default) | Enabled by default |\n| Consider input documents are plain text | 0 as docs_json (1 by default) | Not available |\n| [Sparsed distribution mode](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | default | default |\n| [Sharded distribution mode](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | sharded as mode | Not available |\n| Return all info about matching query | 1 as query (0 by default) | Enabled by default |\n| Skip invalid JSON | 1 as skip_bad_json (0 by default) | Not available |\n| Extended info in [SHOW META](../Node_info_and_management/SHOW_META.md) | 1 as verbose (0 by default) | Not available |\n| Define the number which will be added to document ids if no docs_id fields provided (mostly relevant in [distributed PQ modes](../Creating_a_table/Creating_a_distributed_table/Remote_tables.md#Distributed-percolate-tables-%28DPQ-tables%29)) | 1 as shift (0 by default) | Not available |\n\n\nTo demonstrate how this works, here are a few examples. Let's create a PQ table with two fields:\n\n* title (text)\n* color (string)\n\nand three rules in it:\n\n* Just full-text. Query: `@title bag`\n* Full-text and filtering. Query: `@title shoes`. Filters: `color='red'`\n* Full-text and more complex filtering. Query: `@title shoes`. Filters: `color IN('blue', 'green')`\n\n\n#### SQL\n\n\nCODE_BLOCK_0\n\n\n\nCODE_BLOCK_1\n\n\n\nCODE_BLOCK_2\n\n\n#### JSON\n\n\nCODE_BLOCK_3\n\n\n#### PHP\n\n\nCODE_BLOCK_4\n\nCODE_BLOCK_5\n\nPython\n\n\nCODE_BLOCK_6\n\nCODE_BLOCK_7\n\n\nPython-asyncio\n\n\nCODE_BLOCK_8\n\nCODE_BLOCK_9\n\n\njavascript\n\n\nCODE_BLOCK_10\n\nCODE_BLOCK_11\n\njava\n\n\nCODE_BLOCK_12\n\nCODE_BLOCK_13\n\n\nC#\n\n\nCODE_BLOCK_14\n\nCODE_BLOCK_15\n\n\nRust\n\n\nCODE_BLOCK_16\n\nCODE_BLOCK_17\n\n\nTypeScript\n\nCODE_BLOCK_18\n\nCODE_BLOCK_19\n\n\nGo\n\nCODE_BLOCK_20\n\nCODE_BLOCK_21\n\n\n\n\n##### Just tell me what PQ rules match my single document\n\nThe first document doesn't match any rules. It could match the first two, but they require additional filters.\n\nThe second document matches one rule. Note that CALL PQ by default expects a document to be a JSON, but if you use `0 as docs_json`, you can pass a plain string instead.\n\n\nSQL:\n\n\nCODE_BLOCK_22\n", "translations": { "chinese": "# Percolate \u67e5\u8be2\n\nPercolate \u67e5\u8be2\u4e5f\u88ab\u79f0\u4e3a\u6301\u4e45\u67e5\u8be2\u3001\u524d\u77bb\u641c\u7d22\u3001\u6587\u6863\u8def\u7531\u3001\u9006\u5411\u641c\u7d22\u548c\u53cd\u5411\u641c\u7d22\u3002\n\n\u4f20\u7edf\u7684\u641c\u7d22\u65b9\u5f0f\u662f\u5b58\u50a8\u6587\u6863\u5e76\u5728\u5176\u4e2d\u6267\u884c\u641c\u7d22\u67e5\u8be2\u3002\u7136\u800c\uff0c\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5e0c\u671b\u5c06\u67e5\u8be2\u5e94\u7528\u4e8e\u65b0\u6765\u7684\u6587\u6863\u4ee5\u53d1\u51fa\u5339\u914d\u4fe1\u53f7\u3002\u8fd9\u79cd\u9700\u6c42\u51fa\u73b0\u5728\u76d1\u63a7\u7cfb\u7edf\u4e2d\uff0c\u8fd9\u4e9b\u7cfb\u7edf\u6536\u96c6\u6570\u636e\u5e76\u5411\u7528\u6237\u901a\u77e5\u7279\u5b9a\u4e8b\u4ef6\uff0c\u4f8b\u5982\u67d0\u4e2a\u5ea6\u91cf\u6807\u51c6\u8fbe\u5230\u67d0\u4e2a\u9608\u503c\u6216\u76d1\u63a7\u6570\u636e\u4e2d\u51fa\u73b0\u7279\u5b9a\u503c\u3002\u53e6\u4e00\u4e2a\u4f8b\u5b50\u662f\u65b0\u95fb\u805a\u5408\uff0c\u7528\u6237\u53ef\u80fd\u53ea\u60f3\u6536\u5230\u7279\u5b9a\u7c7b\u522b\u6216\u4e3b\u9898\u7684\u901a\u77e5\uff0c\u751a\u81f3\u7279\u5b9a\u7684\u201c\u5173\u952e\u8bcd\u201d\u3002\n\n\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4f20\u7edf\u7684\u641c\u7d22\u65b9\u5f0f\u5e76\u4e0d\u9002\u7528\uff0c\u56e0\u4e3a\u5b83\u5047\u8bbe\u6240\u9700\u7684\u641c\u7d22\u662f\u5728\u6574\u4e2a\u96c6\u5408\u4e0a\u8fdb\u884c\u7684\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u4f1a\u968f\u7740\u7528\u6237\u7684\u6570\u91cf\u800c\u589e\u52a0\uff0c\u5bfc\u81f4\u8bb8\u591a\u67e5\u8be2\u5728\u6574\u96c6\u4e2d\u8fd0\u884c\uff0c\u4ece\u800c\u9020\u6210\u663e\u8457\u7684\u989d\u5916\u8d1f\u8f7d\u3002\u672c\u8282\u4e2d\u63cf\u8ff0\u7684\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u5c06\u67e5\u8be2\u5b58\u50a8\u8d77\u6765\uff0c\u5e76\u5728\u65b0\u6587\u6863\u6216\u4e00\u6279\u6587\u6863\u4e2d\u6d4b\u8bd5\u5b83\u4eec\u3002\n\nGoogle Alerts\u3001AlertHN\u3001\u5f6d\u535a\u7ec8\u7aef\u548c\u5176\u4ed6\u5141\u8bb8\u7528\u6237\u8ba2\u9605\u7279\u5b9a\u5185\u5bb9\u7684\u7cfb\u7edf\u4f7f\u7528\u7c7b\u4f3c\u7684\u6280\u672f\u3002\n\n> * \u8bf7\u53c2\u9605 [percolate](../Creating_a_table/Local_tables/Percolate_table.md) \u4ee5\u83b7\u53d6\u521b\u5efa PQ \u8868\u7684\u4fe1\u606f\u3002\n> * \u8bf7\u53c2\u9605 [\u5411 percolate \u8868\u6dfb\u52a0\u89c4\u5219](../Data_creation_and_modification/Adding_documents_to_a_table/Adding_rules_to_a_percolate_table.md) \u4ee5\u4e86\u89e3\u5982\u4f55\u6dfb\u52a0 percolate \u89c4\u5219\uff08\u4e5f\u79f0\u4e3a PQ \u89c4\u5219\uff09\u3002\u8fd9\u91cc\u6709\u4e00\u4e2a\u5feb\u901f\u793a\u4f8b\uff1a\n\n### \u4f7f\u7528 CALL PQ \u6267\u884c percolate \u67e5\u8be2\n\n\u5173\u4e8e percolate \u67e5\u8be2\u9700\u8981\u8bb0\u4f4f\u7684\u5173\u952e\u70b9\u662f\uff0c\u4f60\u7684\u641c\u7d22\u67e5\u8be2\u5df2\u7ecf\u5b58\u50a8\u5728\u8868\u4e2d\u3002\u4f60\u9700\u8981\u63d0\u4f9b\u7684\u662f\u4e00\u4e9b\u6587\u6863\uff0c\u4ee5\u68c0\u67e5\u5b83\u4eec\u662f\u5426\u4e0e\u4efb\u4f55\u5b58\u50a8\u7684\u89c4\u5219\u5339\u914d\u3002\n\n\u4f60\u53ef\u4ee5\u901a\u8fc7 SQL \u6216 JSON \u63a5\u53e3\uff0c\u6216\u8005\u4f7f\u7528\u7f16\u7a0b\u8bed\u8a00\u5ba2\u6237\u7aef\u6765\u6267\u884c percolate \u67e5\u8be2\u3002SQL \u65b9\u6cd5\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u7075\u6d3b\u6027\uff0c\u800c HTTP \u65b9\u6cd5\u5219\u66f4\u7b80\u5355\uff0c\u5e76\u63d0\u4f9b\u4e86\u4f60\u6240\u9700\u7684\u5927\u90e8\u529f\u80fd\u3002\u4e0b\u8868\u53ef\u4ee5\u5e2e\u52a9\u4f60\u7406\u89e3\u5b83\u4eec\u4e4b\u95f4\u7684\u5dee\u5f02\u3002\n\n| \u9700\u6c42\u884c\u4e3a | SQL | HTTP |\n| ----------------------------- | --------------------------------------- | ------------------------------------ |\n| \u63d0\u4f9b\u5355\u4e2a\u6587\u6863 | `CALL PQ('tbl', '{doc1}')` | `query.percolate.document{doc1}` |\n| \u63d0\u4f9b\u5355\u4e2a\u6587\u6863\uff08\u66ff\u4ee3\uff09 | `CALL PQ('tbl', 'doc1', 0 as docs_json)` | - |\n| \u63d0\u4f9b\u591a\u4e2a\u6587\u6863 | `CALL PQ('tbl', ('doc1', 'doc2'), 0 as docs_json)` | - |\n| \u63d0\u4f9b\u591a\u4e2a\u6587\u6863\uff08\u66ff\u4ee3\uff09 | `CALL PQ('tbl', ('{doc1}', '{doc2}'))` | - |\n| \u63d0\u4f9b\u591a\u4e2a\u6587\u6863\uff08\u66ff\u4ee3\uff09 | `CALL PQ('tbl', '[{doc1}, {doc2}]')` | - |\n| \u8fd4\u56de\u5339\u914d\u6587\u6863 id | 0/1 as docs (\u9ed8\u8ba4\u7981\u7528) | \u9ed8\u8ba4\u542f\u7528 |\n| \u4f7f\u7528\u6587\u6863\u81ea\u8eab\u7684 id \u663e\u793a\u5728\u7ed3\u679c\u4e2d | 'id field' as docs_id (\u9ed8\u8ba4\u7981\u7528) | \u65e0 |\n| \u8003\u8651\u8f93\u5165\u6587\u6863\u662f JSON | 1 as docs_json (\u9ed8\u8ba4 1) | \u9ed8\u8ba4\u542f\u7528 |\n| \u8003\u8651\u8f93\u5165\u6587\u6863\u662f\u7eaf\u6587\u672c | 0 as docs_json (\u9ed8\u8ba4 1) | \u65e0 |\n| [\u7a00\u758f\u5206\u5e03\u6a21\u5f0f](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | \u9ed8\u8ba4 | \u9ed8\u8ba4 |\n| [\u5206\u7247\u5206\u5e03\u6a21\u5f0f](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | sharded as mode | \u65e0 |\n| \u8fd4\u56de\u5339\u914d\u67e5\u8be2\u7684\u6240\u6709\u4fe1\u606f | 1 as query (\u9ed8\u8ba4 0) | \u9ed8\u8ba4\u542f\u7528 |\n| \u8df3\u8fc7\u65e0\u6548 JSON | 1 as skip_bad_json (\u9ed8\u8ba4 0) | \u65e0 |\n| \u5728 [SHOW META](../Node_info_and_management/SHOW_META.md) \u4e2d\u63d0\u4f9b\u6269\u5c55\u4fe1\u606f | 1 as verbose (\u9ed8\u8ba4 0) | \u65e0 |\n| \u5b9a\u4e49\u5982\u679c\u672a\u63d0\u4f9b docs_id \u5b57\u6bb5\u5c06\u6dfb\u52a0\u5230\u6587\u6863 id \u7684\u6570\u5b57\uff08\u4e3b\u8981\u9002\u7528\u4e8e [\u5206\u5e03\u5f0f PQ \u6a21\u5f0f](../Creating_a_table/Creating_a_distributed_table/Remote_tables.md#Distributed-percolate-tables-%28DPQ-tables%29)\uff09 | 1 as shift (\u9ed8\u8ba4 0) | \u65e0 |\n\n\n\u4e3a\u4e86\u6f14\u793a\u5982\u4f55\u64cd\u4f5c\uff0c\u8fd9\u91cc\u6709\u4e00\u4e9b\u793a\u4f8b\u3002\u8ba9\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u5177\u6709\u4e24\u4e2a\u5b57\u6bb5\u7684 PQ \u8868\uff1a\n\n* title (\u6587\u672c)\n* color (\u5b57\u7b26\u4e32)\n\n\u5e76\u5728\u6b64\u8868\u4e2d\u6dfb\u52a0\u4e09\u4e2a\u89c4\u5219\uff1a\n\n* \u4ec5\u5168\u6587\u641c\u7d22\u3002\u67e5\u8be2: `@title bag`\n* \u5168\u6587\u641c\u7d22\u548c\u8fc7\u6ee4\u3002\u67e5\u8be2: `@title shoes`\u3002\u8fc7\u6ee4: `color='red'`\n* \u5168\u6587\u641c\u7d22\u548c\u66f4\u590d\u6742\u7684\u8fc7\u6ee4\u3002\u67e5\u8be2: `@title shoes`\u3002\u8fc7\u6ee4: `color IN('blue', 'green')`\n\n\n#### SQL\n\n\nCODE_BLOCK_0\n\n\n\nCODE_BLOCK_1\n\n\n\nCODE_BLOCK_2\n\n\n#### JSON\n\n\nCODE_BLOCK_3\n\n\n#### PHP\n\n\nCODE_BLOCK_4\n\nCODE_BLOCK_5\n\nPython\n\n\nCODE_BLOCK_6\n\nCODE_BLOCK_7\n\n\nPython-asyncio\n\n\nCODE_BLOCK_8\n\nCODE_BLOCK_9\n\n\njavascript\n\n\nCODE_BLOCK_10\n\nCODE_BLOCK_11\n\njava\n\n\nCODE_BLOCK_12\n\nCODE_BLOCK_13\n\n\nC#\n\n\nCODE_BLOCK_14\n\nCODE_BLOCK_15\n\n\nRust\n\n\nCODE_BLOCK_16\n\nCODE_BLOCK_17\n\n\nTypeScript\n\nCODE_BLOCK_18\n\nCODE_BLOCK_19\n\n\nGo\n\nCODE_BLOCK_20\n\nCODE_BLOCK_21\n\n\n\n\n##### \u53ea\u544a\u8bc9\u6211\u54ea\u4e9b PQ \u89c4\u5219\u5339\u914d\u6211\u7684\u5355\u4e2a\u6587\u6863\n\n\u7b2c\u4e00\u4e2a\u6587\u6863\u6ca1\u6709\u5339\u914d\u4efb\u4f55\u89c4\u5219\u3002\u5b83\u53ef\u4ee5\u5339\u914d\u524d\u4e24\u4e2a\u89c4\u5219\uff0c\u4f46\u5b83\u4eec\u9700\u8981\u989d\u5916\u7684\u8fc7\u6ee4\u6761\u4ef6\u3002\n\n\u7b2c\u4e8c\u4e2a\u6587\u6863\u5339\u914d\u4e00\u4e2a\u89c4\u5219\u3002\u8bf7\u6ce8\u610f\uff0cCALL PQ \u9ed8\u8ba4\u671f\u671b\u6587\u6863\u662f\u4e00\u4e2a JSON\uff0c\u4f46\u5982\u679c\u4f60\u4f7f\u7528 `0 as docs_json`\uff0c\u4f60\u53ef\u4ee5\u4f20\u9012\u4e00\u4e2a\u7eaf\u5b57\u7b26\u4e32\u3002\n\n\nSQL:\n\n\nCODE_BLOCK_22\n", "russian": "# Percolate Query\n\nPercolate \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u043a\u0430\u043a Persistent queries, Prospective search, document routing, search in reverse \u0438 inverse search.\n\n\u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u043d\u0438\u043c. \u041e\u0434\u043d\u0430\u043a\u043e \u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0432\u043d\u043e\u0432\u044c \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0435\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438, \u0433\u0434\u0435 \u044d\u0442\u043e \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u0445, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u043e\u0433\u0430 \u0434\u043b\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u2014 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0441\u0442\u0435\u0439, \u0433\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u0445\u043e\u0442\u0435\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u0445 \u0438\u043b\u0438 \u0442\u0435\u043c\u0430\u0445, \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \"\u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432\u0430\u0445\".\n\n\u0412 \u044d\u0442\u0438\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u0432\u0441\u0435\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0432\u0441\u0435\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443. \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0430\u043c\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u043c\u0443 \u043d\u043e\u0432\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443 \u0438\u043b\u0438 \u043f\u0430\u043a\u0435\u0442\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432.\n\nGoogle Alerts, AlertHN, Bloomberg Terminal \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e.\n\n> * \u0421\u043c. [percolate](../Creating_a_table/Local_tables/Percolate_table.md) \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 PQ \u0442\u0430\u0431\u043b\u0438\u0446\u044b.\n> * \u0421\u043c. [Adding rules to a percolate table](../Data_creation_and_modification/Adding_documents_to_a_table/Adding_rules_to_a_percolate_table.md), \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c percolate \u043f\u0440\u0430\u0432\u0438\u043b\u0430 (\u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u043a\u0430\u043a PQ \u043f\u0440\u0430\u0432\u0438\u043b\u0430). \u0412\u043e\u0442 \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:\n\n### \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 percolate \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e CALL PQ\n\n\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043e percolate \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445, \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0432\u0430\u0448\u0438 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0443\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u0427\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u2014 \u044d\u0442\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b **\u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0438\u0437 \u043d\u0438\u0445 \u043a\u0430\u043a\u0438\u043c-\u043b\u0438\u0431\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c**.\n\n\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c percolate \u0437\u0430\u043f\u0440\u043e\u0441 \u0447\u0435\u0440\u0435\u0437 SQL \u0438\u043b\u0438 JSON \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. SQL \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a HTTP \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u043e\u0449\u0435 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c \u043f\u043e\u043d\u044f\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f.\n\n| \u0416\u0435\u043b\u0430\u0435\u043c\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 | SQL | HTTP |\n| ----------------------------- | --------------------------------------- | ------------------------------------ |\n| \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 | `CALL PQ('tbl', '{doc1}')` | `query.percolate.document{doc1}` |\n| \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 (\u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430) | `CALL PQ('tbl', 'doc1', 0 as docs_json)` | - |\n| \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 | `CALL PQ('tbl', ('doc1', 'doc2'), 0 as docs_json)` | - |\n| \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430) | `CALL PQ('tbl', ('{doc1}', '{doc2}'))` | - |\n| \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430) | `CALL PQ('tbl', '[{doc1}, {doc2}]')` | - |\n| \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 | 0/1 as docs (\u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) | \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e |\n| \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 id \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 | 'id field' as docs_id (\u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) | \u041d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e |\n| \u0421\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b JSON | 1 as docs_json (1 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) | \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e |\n| \u0421\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c | 0 as docs_json (1 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) | \u041d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e |\n| [\u0420\u0435\u0436\u0438\u043c \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | default | default |\n| [\u0420\u0435\u0436\u0438\u043c \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | sharded as mode | \u041d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e |\n| \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 | 1 as query (0 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) | \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e |\n| \u041f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 JSON | 1 as skip_bad_json (0 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) | \u041d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e |\n| \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432 [SHOW META](../Node_info_and_management/SHOW_META.md) | 1 as verbose (0 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) | \u041d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e |\n| \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u043a \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u043e\u043b\u044f docs_id (\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0432 [\u0440\u0435\u0436\u0438\u043c\u0430\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 PQ](../Creating_a_table/Creating_a_distributed_table/Remote_tables.md#Distributed-percolate-tables-%28DPQ-tables%29)) | 1 as shift (0 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) | \u041d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e |\n\n\n\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0432\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c PQ \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u043b\u044f\u043c\u0438:\n\n* title (\u0442\u0435\u043a\u0441\u0442)\n* color (\u0441\u0442\u0440\u043e\u043a\u0430)\n\n\u0438 \u0442\u0440\u0435\u043c\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u0432 \u043d\u0435\u0439:\n\n* \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u043e\u0438\u0441\u043a. \u0417\u0430\u043f\u0440\u043e\u0441: `@title bag`\n* \u041f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f. \u0417\u0430\u043f\u0440\u043e\u0441: `@title shoes`. \u0424\u0438\u043b\u044c\u0442\u0440\u044b: `color='red'`\n* \u041f\u043e\u043b\u043d\u043e\u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f. \u0417\u0430\u043f\u0440\u043e\u0441: `@title shoes`. \u0424\u0438\u043b\u044c\u0442\u0440\u044b: `color IN('blue', 'green')`\n\n\n#### SQL\n\n\nCODE_BLOCK_0\n\n\n\nCODE_BLOCK_1\n\n\n\nCODE_BLOCK_2\n\n\n#### JSON\n\n\nCODE_BLOCK_3\n\n\n#### PHP\n\n\nCODE_BLOCK_4\n\nCODE_BLOCK_5\n\nPython\n\n\nCODE_BLOCK_6\n\nCODE_BLOCK_7\n\n\nPython-asyncio\n\n\nCODE_BLOCK_8\n\nCODE_BLOCK_9\n\n\njavascript\n\n\nCODE_BLOCK_10\n\nCODE_BLOCK_11\n\njava\n\n\nCODE_BLOCK_12\n\nCODE_BLOCK_13\n\n\nC#\n\n\nCODE_BLOCK_14\n\nCODE_BLOCK_15\n\n\nRust\n\n\nCODE_BLOCK_16\n\nCODE_BLOCK_17\n\n\nTypeScript\n\nCODE_BLOCK_18\n\nCODE_BLOCK_19\n\n\nGo\n\nCODE_BLOCK_20\n\nCODE_BLOCK_21\n\n\n\n\n##### \u041f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u0430\u0436\u0438\u0442\u0435 \u043c\u043d\u0435, \u043a\u0430\u043a\u0438\u0435 PQ \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043c\u043e\u0435\u043c\u0443 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443\n\n\u041f\u0435\u0440\u0432\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443. \u041e\u043d \u043c\u043e\u0433 \u0431\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0432\u0443\u043c, \u043d\u043e \u043e\u043d\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432.\n\n\u0412\u0442\u043e\u0440\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e CALL PQ \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0436\u0438\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 JSON, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 `0 as docs_json`, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443.\n\n\nSQL:\n\n\nCODE_BLOCK_22\n" }, "is_code_or_comment": false, "model": "deepseek/deepseek-v3.2", "updated_at": 1766374376 }, "ef27e50143acea598ab31cbd5361604edde797d868318a8f61deaf12d1dfcc66": { "original": "\n\n##### I want higher performance of a percolate query\nPercolate queries are designed with high throughput and large data volumes in mind. To optimize performance for lower latency and higher throughput, consider the following.\n\nThere are two modes of distribution for a percolate table and how a percolate query can work against it:\n\n* **Sparse (default).** Ideal for: many documents, mirrored PQ tables. When your document set is large but the set of queries stored in the PQ table is small, the sparse mode is beneficial. In this mode, the batch of documents you pass will be divided among the number of agents, so each node processes only a portion of the documents from your request. Manticore splits your document set and distributes chunks among the mirrors. Once the agents have finished processing the queries, Manticore collects and merges the results, returning a final query set as if it came from a single table. Use [replication](../References.md#Replication) to assist the process.\n* **Sharded.** Ideal for: many PQ rules, rules split among PQ tables. In this mode, the entire document set is broadcast to all tables of the distributed PQ table without initially splitting the documents. This is beneficial when pushing a relatively small set of documents, but the number of stored queries is large. In this case, it's more appropriate to store only a portion of PQ rules on each node and then merge the results returned from the nodes that process the same set of documents against different sets of PQ rules. This mode must be explicitly set, as it implies an increase in network payload and expects tables with different PQs, which [replication](../References.md#Replication) cannot do out-of-the-box.\n\nAssume you have table `pq_d2` defined as:\n\nCODE_BLOCK_114\n\n\nEach of 'pq' and 'ptitle' contains:\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_115\n\n\n\nCODE_BLOCK_116\n\n\n\nCODE_BLOCK_117\n\n\n\nCODE_BLOCK_118\n\n\n\nCODE_BLOCK_119\n\n\n\nCODE_BLOCK_120\n\nPython\n\n\nCODE_BLOCK_121\n\nCODE_BLOCK_122\n\n\nPython-asyncio\n\n\nCODE_BLOCK_123\n\nCODE_BLOCK_124\n\n\njavascript\n\n\nCODE_BLOCK_125\n\nCODE_BLOCK_126\n\njavascript\n\n\nCODE_BLOCK_127\n\nCODE_BLOCK_128\n\n\njava\n\n\nCODE_BLOCK_129\n\nCODE_BLOCK_130\n\n\nC#\n\n\nCODE_BLOCK_131\n\nCODE_BLOCK_132\n\n\nRust\n\n\nCODE_BLOCK_133\n\nCODE_BLOCK_134\n\n\nTypeScript\n\n\nCODE_BLOCK_135\n\nCODE_BLOCK_136\n\n\nGo\n\n\nCODE_BLOCK_137\n\nCODE_BLOCK_138\n\n\n\n\n\nAnd you execute `CALL PQ` on the distributed table with a couple of documents.\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_139\n\n\n\nCODE_BLOCK_140\n\n\n\nCODE_BLOCK_141\n\n\n\nCODE_BLOCK_142\n\n\n\nCODE_BLOCK_143\n\n\n\nCODE_BLOCK_144\n\nPython\n\n\nCODE_BLOCK_145\n\nCODE_BLOCK_146\n\n\nPython-asyncio\n\n\nCODE_BLOCK_147\n\nCODE_BLOCK_148\n\n\njavascript\n\n\nCODE_BLOCK_149\n\nCODE_BLOCK_150\n\njava\n\n\nCODE_BLOCK_151\n\nCODE_BLOCK_152\n\n\nC#\n\n\nCODE_BLOCK_153\n\nCODE_BLOCK_154\n\n\nRust\n\n\nCODE_BLOCK_155\n\nCODE_BLOCK_156\n\n\nTypeScript\n\n\nCODE_BLOCK_157\n\nCODE_BLOCK_158\n\n\nGo\n\n\nCODE_BLOCK_159\n\nCODE_BLOCK_160\n\n\n\nIn the previous example, we used the default **sparse** mode. To demonstrate the **sharded** mode, let's create a distributed PQ table consisting of 2 local PQ tables and add 2 documents to \"products1\" and 1 document to \"products2\":\nCODE_BLOCK_161\n\n\nNow, if you add `'sharded' as mode` to `CALL PQ`, it will send the documents to all the agent's tables (in this case, just local tables, but they can be remote to utilize external hardware). This mode is not available via the JSON interface.\n\n\nSQL:\n\n\nCODE_BLOCK_162\n\n\nCODE_BLOCK_163\n\n\n\nNote that the syntax of agent mirrors in the configuration (when several hosts are assigned to one `agent` line, separated with `|`) has nothing to do with the `CALL PQ` query mode. Each `agent` always represents **one** node, regardless of the number of HA mirrors specified for that agent.\n\n\n##### How can I learn more about performance?\nIn some cases, you might want to get more details about the performance of a percolate query. For that purpose, there is the option `1 as verbose`, which is only available via SQL and allows you to save more performance metrics. You can see them using the `SHOW META` query, which you can run after `CALL PQ`. See [SHOW META](../Node_info_and_management/SHOW_META.md) for more info.\n\n\n1 as verbose:\n\n\nCODE_BLOCK_164\n\n\nCODE_BLOCK_165\n\n0 as verbose (default):\n\n\nCODE_BLOCK_166\n\n\nCODE_BLOCK_167\n\n\n\n", "translations": { "chinese": "\n\n##### \u6211\u60f3\u63d0\u9ad8\u6e17\u900f\u67e5\u8be2\u7684\u6027\u80fd\n\u6e17\u900f\u67e5\u8be2\u7684\u8bbe\u8ba1\u521d\u8877\u662f\u5904\u7406\u9ad8\u541e\u5410\u91cf\u548c\u5927\u6570\u636e\u91cf\u3002\u4e3a\u4e86\u4f18\u5316\u6027\u80fd\u4ee5\u5b9e\u73b0\u66f4\u4f4e\u7684\u5ef6\u8fdf\u548c\u66f4\u9ad8\u7684\u541e\u5410\u91cf\uff0c\u8bf7\u8003\u8651\u4ee5\u4e0b\u65b9\u9762\u3002\n\n\u6e17\u900f\u8868\u7684\u5206\u5e03\u6709\u4e24\u79cd\u6a21\u5f0f\uff0c\u6e17\u900f\u67e5\u8be2\u53ef\u4ee5\u9488\u5bf9\u8fd9\u4e9b\u6a21\u5f0f\u5de5\u4f5c\uff1a\n\n* **\u7a00\u758f\u6a21\u5f0f\uff08\u9ed8\u8ba4\uff09\u3002** \u9002\u7528\u4e8e\uff1a\u6587\u6863\u6570\u91cf\u591a\uff0c\u955c\u50cf\u6e17\u900f\u8868\u3002\u5f53\u4f60\u7684\u6587\u6863\u96c6\u5f88\u5927\uff0c\u4f46\u5b58\u50a8\u5728\u6e17\u900f\u8868\u4e2d\u7684\u67e5\u8be2\u96c6\u5f88\u5c0f\u65f6\uff0c\u7a00\u758f\u6a21\u5f0f\u662f\u6709\u76ca\u7684\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e0b\uff0c\u4f60\u4f20\u9012\u7684\u6587\u6863\u6279\u6b21\u5c06\u88ab\u5206\u914d\u5230\u591a\u4e2a\u4ee3\u7406\u4e2d\uff0c\u56e0\u6b64\u6bcf\u4e2a\u8282\u70b9\u53ea\u5904\u7406\u4f60\u8bf7\u6c42\u4e2d\u7684\u4e00\u90e8\u5206\u6587\u6863\u3002Manticore \u4f1a\u5206\u5272\u4f60\u7684\u6587\u6863\u96c6\uff0c\u5e76\u5c06\u5757\u5206\u914d\u7ed9\u5404\u4e2a\u955c\u50cf\u3002\u4e00\u65e6\u4ee3\u7406\u5904\u7406\u5b8c\u67e5\u8be2\uff0cManticore \u4f1a\u6536\u96c6\u5e76\u5408\u5e76\u7ed3\u679c\uff0c\u8fd4\u56de\u4e00\u4e2a\u6700\u7ec8\u7684\u67e5\u8be2\u96c6\uff0c\u5c31\u50cf\u5b83\u6765\u81ea\u5355\u4e2a\u8868\u4e00\u6837\u3002\u4f7f\u7528[\u590d\u5236](../References.md#Replication)\u6765\u8f85\u52a9\u6b64\u8fc7\u7a0b\u3002\n* **\u5206\u7247\u6a21\u5f0f\u3002** \u9002\u7528\u4e8e\uff1a\u6e17\u900f\u89c4\u5219\u6570\u91cf\u591a\uff0c\u89c4\u5219\u5206\u6563\u5728\u591a\u4e2a\u6e17\u900f\u8868\u4e2d\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e0b\uff0c\u6574\u4e2a\u6587\u6863\u96c6\u4f1a\u88ab\u5e7f\u64ad\u5230\u5206\u5e03\u5f0f\u6e17\u900f\u8868\u7684\u6240\u6709\u8868\u4e2d\uff0c\u800c\u4e0d\u4f1a\u521d\u59cb\u5206\u5272\u6587\u6863\u3002\u5f53\u63a8\u9001\u76f8\u5bf9\u8f83\u5c0f\u7684\u6587\u6863\u96c6\uff0c\u4f46\u5b58\u50a8\u7684\u67e5\u8be2\u6570\u91cf\u5f88\u5927\u65f6\uff0c\u8fd9\u79cd\u6a21\u5f0f\u662f\u6709\u76ca\u7684\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u66f4\u5408\u9002\u7684\u662f\u5728\u6bcf\u4e2a\u8282\u70b9\u4e0a\u53ea\u5b58\u50a8\u4e00\u90e8\u5206\u6e17\u900f\u89c4\u5219\uff0c\u7136\u540e\u5408\u5e76\u4ece\u5904\u7406\u76f8\u540c\u6587\u6863\u96c6\u4f46\u9488\u5bf9\u4e0d\u540c\u6e17\u900f\u89c4\u5219\u96c6\u7684\u8282\u70b9\u8fd4\u56de\u7684\u7ed3\u679c\u3002\u8fd9\u79cd\u6a21\u5f0f\u5fc5\u987b\u663e\u5f0f\u8bbe\u7f6e\uff0c\u56e0\u4e3a\u5b83\u610f\u5473\u7740\u7f51\u7edc\u8d1f\u8f7d\u7684\u589e\u52a0\uff0c\u5e76\u4e14\u671f\u671b\u8868\u5177\u6709\u4e0d\u540c\u7684\u6e17\u900f\u89c4\u5219\u96c6\uff0c\u800c[\u590d\u5236](../References.md#Replication)\u65e0\u6cd5\u76f4\u63a5\u5b9e\u73b0\u8fd9\u4e00\u70b9\u3002\n\n\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u8868 `pq_d2` \u5b9a\u4e49\u5982\u4e0b\uff1a\n\nCODE_BLOCK_114\n\n\n'pq' \u548c 'ptitle' \u5404\u81ea\u5305\u542b\uff1a\n\n\n##### SQL\uff1a\n\n\n\nCODE_BLOCK_115\n\n\n\nCODE_BLOCK_116\n\n\n\nCODE_BLOCK_117\n\n\n\nCODE_BLOCK_118\n\n\n\nCODE_BLOCK_119\n\n\n\nCODE_BLOCK_120\n\nPython\n\n\nCODE_BLOCK_121\n\nCODE_BLOCK_122\n\n\nPython-asyncio\n\n\nCODE_BLOCK_123\n\nCODE_BLOCK_124\n\n\njavascript\n\n\nCODE_BLOCK_125\n\nCODE_BLOCK_126\n\njavascript\n\n\nCODE_BLOCK_127\n\nCODE_BLOCK_128\n\n\njava\n\n\nCODE_BLOCK_129\n\nCODE_BLOCK_130\n\n\nC#\n\n\nCODE_BLOCK_131\n\nCODE_BLOCK_132\n\n\nRust\n\n\nCODE_BLOCK_133\n\nCODE_BLOCK_134\n\n\nTypeScript\n\n\nCODE_BLOCK_135\n\nCODE_BLOCK_136\n\n\nGo\n\n\nCODE_BLOCK_137\n\nCODE_BLOCK_138\n\n\n\n\n\n\u5e76\u4e14\u4f60\u5728\u5206\u5e03\u5f0f\u8868\u4e0a\u6267\u884c `CALL PQ`\uff0c\u5e76\u4f20\u5165\u51e0\u4e2a\u6587\u6863\u3002\n\n\n##### SQL\uff1a\n\n\n\nCODE_BLOCK_139\n\n\n\nCODE_BLOCK_140\n\n\n\nCODE_BLOCK_141\n\n\n\nCODE_BLOCK_142\n\n\n\nCODE_BLOCK_143\n\n\n\nCODE_BLOCK_144\n\nPython\n\n\nCODE_BLOCK_145\n\nCODE_BLOCK_146\n\n\nPython-asyncio\n\n\nCODE_BLOCK_147\n\nCODE_BLOCK_148\n\n\njavascript\n\n\nCODE_BLOCK_149\n\nCODE_BLOCK_150\n\njava\n\n\nCODE_BLOCK_151\n\nCODE_BLOCK_152\n\n\nC#\n\n\nCODE_BLOCK_153\n\nCODE_BLOCK_154\n\n\nRust\n\n\nCODE_BLOCK_155\n\nCODE_BLOCK_156\n\n\nTypeScript\n\n\nCODE_BLOCK_157\n\nCODE_BLOCK_158\n\n\nGo\n\n\nCODE_BLOCK_159\n\nCODE_BLOCK_160\n\n\n\n\u5728\u524d\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u9ed8\u8ba4\u7684**\u7a00\u758f**\u6a21\u5f0f\u3002\u4e3a\u4e86\u6f14\u793a**\u5206\u7247**\u6a21\u5f0f\uff0c\u8ba9\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u7531 2 \u4e2a\u672c\u5730\u6e17\u900f\u8868\u7ec4\u6210\u7684\u5206\u5e03\u5f0f\u6e17\u900f\u8868\uff0c\u5e76\u5411 \"products1\" \u6dfb\u52a0 2 \u4e2a\u6587\u6863\uff0c\u5411 \"products2\" \u6dfb\u52a0 1 \u4e2a\u6587\u6863\uff1a\nCODE_BLOCK_161\n\n\n\u73b0\u5728\uff0c\u5982\u679c\u4f60\u5728 `CALL PQ` \u4e2d\u6dfb\u52a0 `'sharded' as mode`\uff0c\u5b83\u4f1a\u5c06\u6587\u6863\u53d1\u9001\u5230\u6240\u6709\u4ee3\u7406\u7684\u8868\uff08\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u53ea\u662f\u672c\u5730\u8868\uff0c\u4f46\u5b83\u4eec\u4e5f\u53ef\u4ee5\u662f\u8fdc\u7a0b\u7684\uff0c\u4ee5\u5229\u7528\u5916\u90e8\u786c\u4ef6\uff09\u3002\u8fd9\u79cd\u6a21\u5f0f\u4e0d\u901a\u8fc7 JSON \u63a5\u53e3\u63d0\u4f9b\u3002\n\n\nSQL\uff1a\n\n\nCODE_BLOCK_162\n\n\nCODE_BLOCK_163\n\n\n\n\u8bf7\u6ce8\u610f\uff0c\u914d\u7f6e\u4e2d\u7684\u4ee3\u7406\u955c\u50cf\u8bed\u6cd5\uff08\u5f53\u591a\u4e2a\u4e3b\u673a\u5206\u914d\u7ed9\u4e00\u4e2a `agent` \u884c\uff0c\u7528 `|` \u5206\u9694\u65f6\uff09\u4e0e `CALL PQ` \u67e5\u8be2\u6a21\u5f0f\u65e0\u5173\u3002\u6bcf\u4e2a `agent` \u59cb\u7ec8\u4ee3\u8868**\u4e00\u4e2a**\u8282\u70b9\uff0c\u65e0\u8bba\u4e3a\u8be5\u4ee3\u7406\u6307\u5b9a\u4e86\u591a\u5c11\u4e2a HA \u955c\u50cf\u3002\n\n\n##### \u5982\u4f55\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u6027\u80fd\u7684\u4fe1\u606f\uff1f\n\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u80fd\u5e0c\u671b\u83b7\u53d6\u66f4\u591a\u5173\u4e8e\u6e17\u900f\u67e5\u8be2\u6027\u80fd\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u4e3a\u6b64\uff0c\u6709\u4e00\u4e2a\u9009\u9879 `1 as verbose`\uff0c\u5b83\u4ec5\u901a\u8fc7 SQL \u53ef\u7528\uff0c\u5141\u8bb8\u4f60\u4fdd\u5b58\u66f4\u591a\u7684\u6027\u80fd\u6307\u6807\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528 `SHOW META` \u67e5\u8be2\u6765\u67e5\u770b\u5b83\u4eec\uff0c\u8be5\u67e5\u8be2\u53ef\u4ee5\u5728 `CALL PQ` \u4e4b\u540e\u8fd0\u884c\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u89c1 [SHOW META](../Node_info_and_management/SHOW_META.md)\u3002\n\n\n1 as verbose\uff1a\n\n\nCODE_BLOCK_164\n\n\nCODE_BLOCK_165\n\n0 as verbose\uff08\u9ed8\u8ba4\uff09\uff1a\n\n\nCODE_BLOCK_166\n\n\nCODE_BLOCK_167\n\n", "russian": "\n\n##### \u042f \u0445\u043e\u0447\u0443 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c percolate-\u0437\u0430\u043f\u0440\u043e\u0441\u0430\nPercolate-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441 \u0446\u0435\u043b\u044c\u044e \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435.\n\n\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0430 \u0440\u0435\u0436\u0438\u043c\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f percolate-\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a percolate-\u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u0439:\n\n* **\u0420\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0439 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e).** \u0418\u0434\u0435\u0430\u043b\u0435\u043d \u0434\u043b\u044f: \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u044b\u0445 PQ-\u0442\u0430\u0431\u043b\u0438\u0446. \u041a\u043e\u0433\u0434\u0430 \u0432\u0430\u0448 \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u0435\u043b\u0438\u043a, \u043d\u043e \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0445\u0441\u044f \u0432 PQ-\u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043c\u0430\u043b, \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0432\u044b\u0433\u043e\u0434\u0435\u043d. \u0412 \u044d\u0442\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u043f\u0430\u043a\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0435, \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0430\u0433\u0435\u043d\u0442\u043e\u0432, \u0442\u0430\u043a \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0437\u0435\u043b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u0432\u0430\u0448\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430. Manticore \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u0430\u0448 \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0437\u0435\u0440\u043a\u0430\u043b\u0430\u043c\u0438. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0433\u0435\u043d\u0442\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, Manticore \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u043e\u043d \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 [\u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044e](../References.md#Replication), \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443.\n* **\u0421\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439.** \u0418\u0434\u0435\u0430\u043b\u0435\u043d \u0434\u043b\u044f: \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 PQ-\u043f\u0440\u0430\u0432\u0438\u043b, \u043f\u0440\u0430\u0432\u0438\u043b, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 PQ-\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438. \u0412 \u044d\u0442\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0432\u0435\u0441\u044c \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 PQ-\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0435\u0437 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u042d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043d\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u0435\u043b\u0438\u043a\u043e. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u043b\u0435\u0435 \u0443\u043c\u0435\u0441\u0442\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c PQ-\u043f\u0440\u0430\u0432\u0438\u043b \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0437\u043b\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 \u0443\u0437\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043d\u0430\u0431\u043e\u0440\u0430\u043c\u0438 PQ-\u043f\u0440\u0430\u0432\u0438\u043b. \u042d\u0442\u043e\u0442 \u0440\u0435\u0436\u0438\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u044f\u0432\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 PQ, \u0447\u0442\u043e [\u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f](../References.md#Replication) \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438.\n\n\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430 `pq_d2`, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u043a\u0430\u043a:\n\nCODE_BLOCK_114\n\n\n\u041a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 'pq' \u0438 'ptitle' \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442:\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_115\n\n\n\nCODE_BLOCK_116\n\n\n\nCODE_BLOCK_117\n\n\n\nCODE_BLOCK_118\n\n\n\nCODE_BLOCK_119\n\n\n\nCODE_BLOCK_120\n\nPython\n\n\nCODE_BLOCK_121\n\nCODE_BLOCK_122\n\n\nPython-asyncio\n\n\nCODE_BLOCK_123\n\nCODE_BLOCK_124\n\n\njavascript\n\n\nCODE_BLOCK_125\n\nCODE_BLOCK_126\n\njavascript\n\n\nCODE_BLOCK_127\n\nCODE_BLOCK_128\n\n\njava\n\n\nCODE_BLOCK_129\n\nCODE_BLOCK_130\n\n\nC#\n\n\nCODE_BLOCK_131\n\nCODE_BLOCK_132\n\n\nRust\n\n\nCODE_BLOCK_133\n\nCODE_BLOCK_134\n\n\nTypeScript\n\n\nCODE_BLOCK_135\n\nCODE_BLOCK_136\n\n\nGo\n\n\nCODE_BLOCK_137\n\nCODE_BLOCK_138\n\n\n\n\n\n\u0418 \u0432\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0435 `CALL PQ` \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441 \u043f\u0430\u0440\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432.\n\n\n##### SQL:\n\n\n\nCODE_BLOCK_139\n\n\n\nCODE_BLOCK_140\n\n\n\nCODE_BLOCK_141\n\n\n\nCODE_BLOCK_142\n\n\n\nCODE_BLOCK_143\n\n\n\nCODE_BLOCK_144\n\nPython\n\n\nCODE_BLOCK_145\n\nCODE_BLOCK_146\n\n\nPython-asyncio\n\n\nCODE_BLOCK_147\n\nCODE_BLOCK_148\n\n\njavascript\n\n\nCODE_BLOCK_149\n\nCODE_BLOCK_150\n\njava\n\n\nCODE_BLOCK_151\n\nCODE_BLOCK_152\n\n\nC#\n\n\nCODE_BLOCK_153\n\nCODE_BLOCK_154\n\n\nRust\n\n\nCODE_BLOCK_155\n\nCODE_BLOCK_156\n\n\nTypeScript\n\n\nCODE_BLOCK_157\n\nCODE_BLOCK_158\n\n\nGo\n\n\nCODE_BLOCK_159\n\nCODE_BLOCK_160\n\n\n\n\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0440\u0435\u0436\u0438\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e **\u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0439**. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c **\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439** \u0440\u0435\u0436\u0438\u043c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e PQ-\u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u0438\u0437 2 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 PQ-\u0442\u0430\u0431\u043b\u0438\u0446, \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c 2 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \"products1\" \u0438 1 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0432 \"products2\":\nCODE_BLOCK_161\n\n\n\u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0432\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435 `'sharded' as mode` \u0432 `CALL PQ`, \u043e\u043d \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u043e \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0430\u0433\u0435\u043d\u0442\u043e\u0432 (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u0440\u043e\u0441\u0442\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u043e \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0435). \u042d\u0442\u043e\u0442 \u0440\u0435\u0436\u0438\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0447\u0435\u0440\u0435\u0437 JSON-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.\n\n\nSQL:\n\n\nCODE_BLOCK_162\n\n\nCODE_BLOCK_163\n\n\n\n\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0437\u0435\u0440\u043a\u0430\u043b \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 (\u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0441\u0442\u043e\u0432 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 `agent`, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 `|`) \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043e\u0431\u0449\u0435\u0433\u043e \u0441 \u0440\u0435\u0436\u0438\u043c\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 `CALL PQ`. \u041a\u0430\u0436\u0434\u044b\u0439 `agent` \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 **\u043e\u0434\u0438\u043d** \u0443\u0437\u0435\u043b, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0437\u0435\u0440\u043a\u0430\u043b \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430.\n\n\n##### \u041a\u0430\u043a \u044f \u043c\u043e\u0433\u0443 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438?\n\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 percolate-\u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u043f\u0446\u0438\u044f `1 as verbose`, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 SQL \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043c\u0435\u0442\u0440\u0438\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 `SHOW META`, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435 `CALL PQ`. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441\u043c. \u0432 [SHOW META](../Node_info_and_management/SHOW_META.md).\n\n\n1 as verbose:\n\n\nCODE_BLOCK_164\n\n\nCODE_BLOCK_165\n\n0 as verbose (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e):\n\n\nCODE_BLOCK_166\n\n\nCODE_BLOCK_167\n\n" }, "is_code_or_comment": false, "model": "deepseek/deepseek-v3.2", "updated_at": 1766374248 }, "__meta": { "source_text": "# Percolate Query\n\nPercolate queries are also known as Persistent queries, Prospective search, document routing, search in reverse, and inverse search.\n\nThe traditional way of conducting searches involves storing documents and performing search queries against them. However, there are cases where we want to apply a query to a newly incoming document to signal a match. Some scenarios where this is desired include monitoring systems that collect data and notify users about specific events, such as reaching a certain threshold for a metric or a particular value appearing in the monitored data. Another example is news aggregation, where users may want to be notified only about certain categories or topics, or even specific \"keywords.\"\n\nIn these situations, traditional search is not the best fit, as it assumes the desired search is performed over the entire collection. This process gets multiplied by the number of users, resulting in many queries running over the entire collection, which can cause significant additional load. The alternative approach described in this section involves storing the queries instead and testing them against an incoming new document or a batch of documents.\n\nGoogle Alerts, AlertHN, Bloomberg Terminal, and other systems that allow users to subscribe to specific content utilize similar technology.\n\n> * See [percolate](../Creating_a_table/Local_tables/Percolate_table.md) for information on creating a PQ table.\n> * See [Adding rules to a percolate table](../Data_creation_and_modification/Adding_documents_to_a_table/Adding_rules_to_a_percolate_table.md) to learn how to add percolate rules (also known as PQ rules). Here's a quick example:\n\n\n### Performing a percolate query with CALL PQ\n\nThe key thing to remember about percolate queries is that your search queries are already in the table. What you need to provide are documents **to check if any of them match any of the stored rules**.\n\nYou can perform a percolate query via SQL or JSON interfaces, as well as using programming language clients. The SQL approach offers more flexibility, while the HTTP method is simpler and provides most of what you need. The table below can help you understand the differences.\n\n| Desired Behavior | SQL | HTTP |\n| ----------------------------- | --------------------------------------- | ------------------------------------ |\n| Provide a single document | `CALL PQ('tbl', '{doc1}')` | `query.percolate.document{doc1}` |\n| Provide a single document (alternative) | `CALL PQ('tbl', 'doc1', 0 as docs_json)` | - |\n| Provide multiple documents | `CALL PQ('tbl', ('doc1', 'doc2'), 0 as docs_json)` | - |\n| Provide multiple documents (alternative) | `CALL PQ('tbl', ('{doc1}', '{doc2}'))` | - |\n| Provide multiple documents (alternative) | `CALL PQ('tbl', '[{doc1}, {doc2}]')` | - |\n| Return matching document ids | 0/1 as docs (disabled by default) | Enabled by default |\n| Use document's own id to show in the result | 'id field' as docs_id (disabled by default) | Not available |\n| Consider input documents are JSON | 1 as docs_json (1 by default) | Enabled by default |\n| Consider input documents are plain text | 0 as docs_json (1 by default) | Not available |\n| [Sparsed distribution mode](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | default | default |\n| [Sharded distribution mode](../Searching/Percolate_query.md#I-want-higher-performance-of-a-percolate-query) | sharded as mode | Not available |\n| Return all info about matching query | 1 as query (0 by default) | Enabled by default |\n| Skip invalid JSON | 1 as skip_bad_json (0 by default) | Not available |\n| Extended info in [SHOW META](../Node_info_and_management/SHOW_META.md) | 1 as verbose (0 by default) | Not available |\n| Define the number which will be added to document ids if no docs_id fields provided (mostly relevant in [distributed PQ modes](../Creating_a_table/Creating_a_distributed_table/Remote_tables.md#Distributed-percolate-tables-%28DPQ-tables%29)) | 1 as shift (0 by default) | Not available |\n\n\nTo demonstrate how this works, here are a few examples. Let's create a PQ table with two fields:\n\n* title (text)\n* color (string)\n\nand three rules in it:\n\n* Just full-text. Query: `@title bag`\n* Full-text and filtering. Query: `@title shoes`. Filters: `color='red'`\n* Full-text and more complex filtering. Query: `@title shoes`. Filters: `color IN('blue', 'green')`\n\n\n#### SQL\n\n\n```sql\nCREATE TABLE products(title text, color string) type='pq';\nINSERT INTO products(query) values('@title bag');\nINSERT INTO products(query,filters) values('@title shoes', 'color=\\'red\\'');\nINSERT INTO products(query,filters) values('@title shoes', 'color in (\\'blue\\', \\'green\\')');\nselect * from products;\n```\n\n\n\n```sql\n+---------------------+--------------+------+---------------------------+\n| id | query | tags | filters |\n+---------------------+--------------+------+---------------------------+\n| 1657852401006149635 | @title shoes | | color IN ('blue, 'green') |\n| 1657852401006149636 | @title shoes | | color='red' |\n| 1657852401006149637 | @title bag | | |\n+---------------------+--------------+------+---------------------------+\n```\n\n\n\n```json\nPUT /pq/products/doc/\n{\n \"query\": {\n \"match\": {\n \"title\": \"bag\"\n }\n },\n \"filters\": \"\"\n}\n\nPUT /pq/products/doc/\n{\n \"query\": {\n \"match\": {\n \"title\": \"shoes\"\n }\n },\n \"filters\": \"color='red'\"\n}\n\nPUT /pq/products/doc/\n{\n \"query\": {\n \"match\": {\n \"title\": \"shoes\"\n }\n },\n \"filters\": \"color IN ('blue', 'green')\"\n}\n```\n\n\n#### JSON\n\n\n```json\n{\n \"table\": \"products\",\n \"type\": \"doc\",\n \"_id\": 1657852401006149661,\n \"result\": \"created\"\n}\n{\n \"table\": \"products\",\n \"type\": \"doc\",\n \"_id\": 1657852401006149662,\n \"result\": \"created\"\n}\n{\n \"table\": \"products\",\n \"type\": \"doc\",\n \"_id\": 1657852401006149663,\n \"result\": \"created\"\n}\n```\n\n\n#### PHP\n\n\n```php\n\n$index = [\n 'table' => 'products',\n 'body' => [\n 'columns' => [\n 'title' => ['type' => 'text'],\n 'color' => ['type' => 'string']\n ],\n 'settings' => [\n 'type' => 'pq'\n ]\n ]\n];\n$client->indices()->create($index);\n\n$query = [\n 'table' => 'products',\n 'body' => [ 'query'=>['match'=>['title'=>'bag']]]\n];\n$client->pq()->doc($query);\n$query = [\n 'table' => 'products',\n 'body' => [ 'query'=>['match'=>['title'=>'shoes']],'filters'=>\"color='red'\"]\n];\n$client->pq()->doc($query);\n\n\n$query = [\n 'table' => 'products',\n 'body' => [ 'query'=>['match'=>['title'=>'shoes']],'filters'=>\"color IN ('blue', 'green')\"]\n];\n$client->pq()->doc($query);\n```\n\n``` php\nArray(\n [table] => products\n [type] => doc\n [_id] => 1657852401006149661\n [result] => created\n)\nArray(\n [table] => products\n [type] => doc\n [_id] => 1657852401006149662\n [result] => created\n)\nArray(\n [table] => products\n [type] => doc\n [_id] => 1657852401006149663\n [result] => created\n)\n```\n\nPython\n\n\n```python\nutilsApi.sql('create table products(title text, color string) type=\\'pq\\'')\nindexApi.insert({\"table\" : \"products\", \"doc\" : {\"query\" : \"@title bag\" }})\nindexApi.insert({\"table\" : \"products\", \"doc\" : {\"query\" : \"@title shoes\", \"filters\": \"color='red'\" }})\nindexApi.insert({\"table\" : \"products\", \"doc\" : {\"query\" : \"@title shoes\",\"filters\": \"color IN ('blue', 'green')\" }})\n```\n\n``` python\n{'created': True,\n 'found': None,\n 'id': 0,\n 'table': 'products',\n 'result': 'created'}\n{'created': True,\n 'found': None,\n 'id': 0,\n 'table': 'products',\n 'result': 'created'}\n{'created': True,\n 'found': None,\n 'id': 0,\n 'table': 'products',\n 'result': 'created'}\n```\n\n\nPython-asyncio\n\n\n```python\nawait utilsApi.sql('create table products(title text, color string) type=\\'pq\\'')\nawait indexApi.insert({\"table\" : \"products\", \"doc\" : {\"query\" : \"@title bag\" }})\nawait indexApi.insert({\"table\" : \"products\", \"doc\" : {\"query\" : \"@title shoes\", \"filters\": \"color='red'\" }})\nawait indexApi.insert({\"table\" : \"products\", \"doc\" : {\"query\" : \"@title shoes\",\"filters\": \"color IN ('blue', 'green')\" }})\n```\n\n``` python\n{'created': True,\n 'found': None,\n 'id': 0,\n 'table': 'products',\n 'result': 'created'}\n{'created': True,\n 'found': None,\n 'id': 0,\n 'table': 'products',\n 'result': 'created'}\n{'created': True,\n 'found': None,\n 'id': 0,\n 'table': 'products',\n 'result': 'created'}\n```\n\n\njavascript\n\n\n```javascript\nres = await utilsApi.sql('create table products(title text, color string) type=\\'pq\\'');\nres = indexApi.insert({\"table\" : \"products\", \"doc\" : {\"query\" : \"@title bag\" }});\nres = indexApi.insert({\"table\" : \"products\", \"doc\" : {\"query\" : \"@title shoes\", \"filters\": \"color='red'\" }});\nres = indexApi.insert({\"table\" : \"products\", \"doc\" : {\"query\" : \"@title shoes\",\"filters\": \"color IN ('blue', 'green')\" }});\n```\n\n``` javascript\n\"table\":\"products\",\"_id\":0,\"created\":true,\"result\":\"created\"}\n{\"table\":\"products\",\"_id\":0,\"created\":true,\"result\":\"created\"}\n{\"table\":\"products\",\"_id\":0,\"created\":true,\"result\":\"created\"}\n```\n\njava\n\n\n```java\nutilsApi.sql(\"create table products(title text, color string) type='pq'\", true);\ndoc = new HashMap(){{\n put(\"query\", \"@title bag\");\n}};\nnewdoc = new InsertDocumentRequest();\nnewdoc.index(\"products\").setDoc(doc);\nindexApi.insert(newdoc);\n\ndoc = new HashMap(){{\n put(\"query\", \"@title shoes\");\n put(\"filters\", \"color='red'\");\n}};\nnewdoc = new InsertDocumentRequest();\nnewdoc.index(\"products\").setDoc(doc);\nindexApi.insert(newdoc);\n\ndoc = new HashMap(){{\n put(\"query\", \"@title shoes\");\n put(\"filters\", \"color IN ('blue', 'green')\");\n}};\nnewdoc = new InsertDocumentRequest();\nnewdoc.index(\"products\").setDoc(doc);\nindexApi.insert(newdoc);\n```\n\n``` java\n{total=0, error=, warning=}\nclass SuccessResponse {\n index: products\n id: 0\n created: true\n result: created\n found: null\n}\nclass SuccessResponse {\n index: products\n id: 0\n created: true\n result: created\n found: null\n}\nclass SuccessResponse {\n index: products\n id: 0\n created: true\n result: created\n found: null\n}\n\n```\n\n\nC#\n\n\n```clike\nutilsApi.Sql(\"create table products(title text, color string) type='pq'\", true);\n\nDictionary doc = new Dictionary();\ndoc.Add(\"query\", \"@title bag\");\nInsertDocumentRequest newdoc = new InsertDocumentRequest(index: \"products\", doc: doc);\nindexApi.Insert(newdoc);\n\ndoc = new Dictionary();\ndoc.Add(\"query\", \"@title shoes\");\ndoc.Add(\"filters\", \"color='red'\");\nnewdoc = new InsertDocumentRequest(index: \"products\", doc: doc);\nindexApi.Insert(newdoc);\n\ndoc = new Dictionary();\ndoc.Add(\"query\", \"@title bag\");\ndoc.Add(\"filters\", \"color IN ('blue', 'green')\");\nnewdoc = new InsertDocumentRequest(index: \"products\", doc: doc);\nindexApi.Insert(newdoc);\n```\n\n``` clike\n{total=0, error=\"\", warning=\"\"}\n\nclass SuccessResponse {\n index: products\n id: 0\n created: true\n result: created\n found: null\n}\nclass SuccessResponse {\n index: products\n id: 0\n created: true\n result: created\n found: null\n}\nclass SuccessResponse {\n index: products\n id: 0\n created: true\n result: created\n found: null\n}\n\n```\n\n\nRust\n\n\n```rust\nutils_api.sql(\"create table products(title text, color string) type='pq'\", Some(true)).await;\n\nlet mut doc1 = HashMap::new();\ndoc1.insert(\"query\".to_string(), serde_json::json!(\"@title bag\"));\nlet insert_req1 = InsertDocumentRequest::new(\"products\".to_string(), serde_json::json!(doc1));\nindex_api.insert(insert_req1).await;\n\nlet mut doc2 = HashMap::new();\ndoc2.insert(\"query\".to_string(), serde_json::json!(\"@title shoes\"));\ndoc2.insert(\"filters\".to_string(), serde_json::json!(\"color='red'\"));\nlet insert_req2 = InsertDocumentRequest::new(\"products\".to_string(), serde_json::json!(doc2));\nindex_api.insert(insert_req2).await;\n\nlet mut doc3 = HashMap::new();\ndoc3.insert(\"query\".to_string(), serde_json::json!(\"@title bag\"));\ndoc3.insert(\"filters\".to_string(), serde_json::json!(\"color IN ('blue', 'green')\"));\nlet insert_req3 = InsertDocumentRequest::new(\"products\".to_string(), serde_json::json!(doc3));\nindex_api.insert(insert_req3).await;\n```\n\n``` rust\n{total=0, error=\"\", warning=\"\"}\n\nclass SuccessResponse {\n index: products\n id: 0\n created: true\n result: created\n found: null\n}\nclass SuccessResponse {\n index: products\n id: 0\n created: true\n result: created\n found: null\n}\nclass SuccessResponse {\n index: products\n id: 0\n created: true\n result: created\n found: null\n}\n\n```\n\n\nTypeScript\n\n```typescript\nres = await utilsApi.sql(\"create table test_pq(title text, color string) type='pq'\");\nres = indexApi.insert({\n index: 'test_pq',\n doc: { query : '@title bag' }\n});\nres = indexApi.insert(\n index: 'test_pq',\n doc: { query: '@title shoes', filters: \"color='red'\" }\n});\nres = indexApi.insert({\n index: 'test_pq',\n doc: { query : '@title shoes', filters: \"color IN ('blue', 'green')\" }\n});\n```\n\n``` typescript\n{\n\t\"table\":\"test_pq\",\n\t\"_id\":1657852401006149661,\n\t\"created\":true,\n\t\"result\":\"created\"\n}\n{\n\t\"table\":\"test_pq\",\n\t\"_id\":1657852401006149662,\n\t\"created\":true,\n\t\"result\":\"created\"\n}\n{\n\t\"table\":\"test_pq\",\n\t\"_id\":1657852401006149663,\n\t\"created\":true,\n\t\"result\":\"created\"\n}\n```\n\n\nGo\n\n```go\napiClient.UtilsAPI.Sql(context.Background()).Body(\"create table test_pq(title text, color string) type='pq'\").Execute()\n\nindexDoc := map[string]interface{} {\"query\": \"@title bag\"}\nindexReq := manticoreclient.NewInsertDocumentRequest(\"test_pq\", indexDoc)\napiClient.IndexAPI.Insert(context.Background()).InsertDocumentRequest(*indexReq).Execute();\n\nindexDoc = map[string]interface{} {\"query\": \"@title shoes\", \"filters\": \"color='red'\"}\nindexReq = manticoreclient.NewInsertDocumentRequest(\"test_pq\", indexDoc)\napiClient.IndexAPI.Insert(context.Background()).InsertDocumentRequest(*indexReq).Execute();\n\nindexDoc = map[string]interface{} {\"query\": \"@title shoes\", \"filters\": \"color IN ('blue', 'green')\"}\nindexReq = manticoreclient.NewInsertDocumentRequest(\"test_pq\", indexDoc)\napiClient.IndexAPI.Insert(context.Background()).InsertDocumentRequest(*indexReq).Execute();\n```\n\n``` go\n{\n\t\"table\":\"test_pq\",\n\t\"_id\":1657852401006149661,\n\t\"created\":true,\n\t\"result\":\"created\"\n}\n{\n\t\"table\":\"test_pq\",\n\t\"_id\":1657852401006149662,\n\t\"created\":true,\n\t\"result\":\"created\"\n}\n{\n\t\"table\":\"test_pq\",\n\t\"_id\":1657852401006149663,\n\t\"created\":true,\n\t\"result\":\"created\"\n}\n```\n\n\n\n\n##### Just tell me what PQ rules match my single document\n\nThe first document doesn't match any rules. It could match the first two, but they require additional filters.\n\nThe second document matches one rule. Note that CALL PQ by default expects a document to be a JSON, but if you use `0 as docs_json`, you can pass a plain string instead.\n\n\nSQL:\n\n\n```sql\nCALL PQ('products', 'Beautiful shoes', 0 as docs_json);\n\nCALL PQ('products', 'What a nice bag', 0 as docs_json);\nCALL PQ('products', '{\"title\": \"What a nice bag\"}');\n```\n\n\n```sql\n+---------------------+\n| id |\n+---------------------+\n| 1657852401006149637 |\n+---------------------+\n\n+---------------------+\n| id |\n+---------------------+\n| 1657852401006149637 |\n+---------------------+\n```\n\nJSON:\n\n\n```json\nPOST /pq/products/search\n{\n \"query\": {\n \"percolate\": {\n \"document\": {\n \"title\": \"What a nice bag\"\n }\n }\n }\n}\n```\n\n\n```json\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 1,\n \"max_score\": 1,\n \"hits\": [\n {\n \"table\": \"products\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149644,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\nPHP:\n\n\n```php\n$percolate = [\n 'table' => 'products',\n 'body' => [\n 'query' => [\n 'percolate' => [\n 'document' => [\n 'title' => 'What a nice bag'\n ]\n ]\n ]\n ]\n];\n$client->pq()->search($percolate);\n\n```\n\n\n```php\nArray\n(\n [took] => 0\n [timed_out] =>\n [hits] => Array\n (\n [total] => 1\n [max_score] => 1\n [hits] => Array\n (\n [0] => Array\n (\n [_index] => products\n [_type] => doc\n [_id] => 1657852401006149644\n [_score] => 1\n [_source] => Array\n (\n [query] => Array\n (\n [match] => Array\n (\n [title] => bag\n )\n )\n )\n [fields] => Array\n (\n [_percolator_document_slot] => Array\n (\n [0] => 1\n )\n )\n )\n )\n )\n)\n```\n\nPython\n\n\n```python\nsearchApi.percolate('products',{\"query\":{\"percolate\":{\"document\":{\"title\":\"What a nice bag\"}}}})\n```\n\n``` python\n{'hits': {'hits': [{u'_id': u'2811025403043381480',\n u'table': u'products',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'@title bag'}},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}}],\n 'total': 1},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n```\n\n\nPython-asyncio\n\n\n```python\nawait searchApi.percolate('products',{\"query\":{\"percolate\":{\"document\":{\"title\":\"What a nice bag\"}}}})\n```\n\n``` python\n{'hits': {'hits': [{u'_id': u'2811025403043381480',\n u'table': u'products',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'@title bag'}},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}}],\n 'total': 1},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n```\n\n\njavascript\n\n\n```javascript\nres = await searchApi.percolate('products',{\"query\":{\"percolate\":{\"document\":{\"title\":\"What a nice bag\"}}}});\n```\n\n``` javascript\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 1,\n \"hits\": [\n {\n \"table\": \"products\",\n \"_type\": \"doc\",\n \"_id\": 2811045522851233808,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\njava\n\n\n```java\nPercolateRequest percolateRequest = new PercolateRequest();\nquery = new HashMap(){{\n put(\"percolate\",new HashMap(){{\n put(\"document\", new HashMap(){{\n put(\"title\",\"what a nice bag\");\n }});\n }});\n}};\npercolateRequest.query(query);\nsearchApi.percolate(\"test_pq\",percolateRequest);\n```\n\n``` java\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 1\n maxScore: 1\n hits: [{_index=products, _type=doc, _id=2811045522851234109, _score=1, _source={query={ql=@title bag}}, fields={_percolator_document_slot=[1]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nC#\n\n\n```clike\nDictionary percolateDoc = new Dictionary();\npercolateDoc.Add(\"document\", new Dictionary {{ \"title\", \"what a nice bag\" }});\nDictionary query = new Dictionary {{ \"percolate\", percolateDoc }};\nPercolateRequest percolateRequest = new PercolateRequest(query=query);\nsearchApi.Percolate(\"test_pq\",percolateRequest);\n\n```\n\n``` clike\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 1\n maxScore: 1\n hits: [{_index=products, _type=doc, _id=2811045522851234109, _score=1, _source={query={ql=@title bag}}, fields={_percolator_document_slot=[1]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nRust\n\n\n```rust\nlet mut percolate_doc_fields = HashMap::new();\npercolate_doc_fileds.insert(\"title\".to_string(), \"what a nice bag\");\nlet mut percolate_doc = HashMap::new();\npercolate_doc.insert(\"document\".to_string(), percolate_doc_fields);\nlet percolate_query = PercolateRequestQuery::new(serde_json::json!(percolate_doc));\nlet percolate_req = PercolateRequest::new(percolate_query);\nsearch_api.percolate(\"test_pq\", percolate_req).await;\n```\n\n``` rust\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 1\n maxScore: 1\n hits: [{_index=products, _type=doc, _id=2811045522851234109, _score=1, _source={query={ql=@title bag}}, fields={_percolator_document_slot=[1]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nTypeScript\n\n\n```typescript\nres = await searchApi.percolate('test_pq', { query: { percolate: { document : { title : 'What a nice bag' } } } } );\n```\n\n``` typescript\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 1,\n \"hits\": [\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149661,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\n\nGo\n\n\n```go\nquery := map[string]interface{} {\"title\": \"what a nice bag\"}\npercolateRequestQuery := manticoreclient.NewPercolateQuery(query)\npercolateRequest := manticoreclient.NewPercolateRequest(percolateRequestQuery)\nres, _, _ := apiClient.SearchAPI.Percolate(context.Background(), \"test_pq\").PercolateRequest(*percolateRequest).Execute()\n\n```\n\n``` go\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 1,\n \"hits\": [\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149661,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\n\n\n\n##### I want to know complete PQ rules matching my document\n\nSQL:\n\n\n```sql\nCALL PQ('products', '{\"title\": \"What a nice bag\"}', 1 as query);\n```\n\n\n```sql\n+---------------------+------------+------+---------+\n| id | query | tags | filters |\n+---------------------+------------+------+---------+\n| 1657852401006149637 | @title bag | | |\n+---------------------+------------+------+---------+\n```\n\nJSON:\n\n\n```json\nPOST /pq/products/search\n{\n \"query\": {\n \"percolate\": {\n \"document\": {\n \"title\": \"What a nice bag\"\n }\n }\n }\n}\n```\n\n\n```json\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 1,\n \"max_score\": 1,\n \"hits\": [\n {\n \"table\": \"products\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149644,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\nPHP:\n\n\n```php\n$percolate = [\n 'table' => 'products',\n 'body' => [\n 'query' => [\n 'percolate' => [\n 'document' => [\n 'title' => 'What a nice bag'\n ]\n ]\n ]\n ]\n];\n$client->pq()->search($percolate);\n\n```\n\n\n```php\nArray\n(\n [took] => 0\n [timed_out] =>\n [hits] => Array\n (\n [total] => 1\n [max_score] => 1\n [hits] => Array\n (\n [0] => Array\n (\n [_index] => products\n [_type] => doc\n [_id] => 1657852401006149644\n [_score] => 1\n [_source] => Array\n (\n [query] => Array\n (\n [match] => Array\n (\n [title] => bag\n )\n )\n )\n [fields] => Array\n (\n [_percolator_document_slot] => Array\n (\n [0] => 1\n )\n )\n )\n )\n )\n)\n```\n\n\nPython\n\n\n```python\nsearchApi.percolate('products',{\"query\":{\"percolate\":{\"document\":{\"title\":\"What a nice bag\"}}}})\n```\n\n``` python\n{'hits': {'hits': [{u'_id': u'2811025403043381480',\n u'table': u'products',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'@title bag'}},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}}],\n 'total': 1},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n```\n\n\nPython-asyncio\n\n\n```python\nawait searchApi.percolate('products',{\"query\":{\"percolate\":{\"document\":{\"title\":\"What a nice bag\"}}}})\n```\n\n``` python\n{'hits': {'hits': [{u'_id': u'2811025403043381480',\n u'table': u'products',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'@title bag'}},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}}],\n 'total': 1},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n```\n\n\njavascript\n\n\n```javascript\nres = await searchApi.percolate('products',{\"query\":{\"percolate\":{\"document\":{\"title\":\"What a nice bag\"}}}});\n```\n\n``` javascript\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 1,\n \"hits\": [\n {\n \"table\": \"products\",\n \"_type\": \"doc\",\n \"_id\": 2811045522851233808,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\n\njava\n\n\n```java\nPercolateRequest percolateRequest = new PercolateRequest();\nquery = new HashMap(){{\n put(\"percolate\",new HashMap(){{\n put(\"document\", new HashMap(){{\n put(\"title\",\"what a nice bag\");\n }});\n }});\n}};\npercolateRequest.query(query);\nsearchApi.percolate(\"test_pq\",percolateRequest);\n```\n\n``` java\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 1\n maxScore: 1\n hits: [{_index=products, _type=doc, _id=2811045522851234109, _score=1, _source={query={ql=@title bag}}, fields={_percolator_document_slot=[1]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nC#\n\n\n```clike\nDictionary percolateDoc = new Dictionary();\npercolateDoc.Add(\"document\", new Dictionary {{ \"title\", \"what a nice bag\" }});\nDictionary query = new Dictionary {{ \"percolate\", percolateDoc }};\nPercolateRequest percolateRequest = new PercolateRequest(query=query);\nsearchApi.Percolate(\"test_pq\",percolateRequest);\n\n```\n\n``` clike\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 1\n maxScore: 1\n hits: [{_index=products, _type=doc, _id=2811045522851234109, _score=1, _source={query={ql=@title bag}}, fields={_percolator_document_slot=[1]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nRust\n\n\n```rust\nlet mut percolate_doc_fields = HashMap::new();\npercolate_doc_fileds.insert(\"title\".to_string(), \"what a nice bag\");\nlet mut percolate_doc = HashMap::new();\npercolate_doc.insert(\"document\".to_string(), percolate_doc_fields);\nlet percolate_query = PercolateRequestQuery::new(serde_json::json!(percolate_doc));\nlet percolate_req = PercolateRequest::new(percolate_query);\nsearch_api.percolate(\"test_pq\", percolate_req).await;\n\n```\n\n``` rust\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 1\n maxScore: 1\n hits: [{_index=products, _type=doc, _id=2811045522851234109, _score=1, _source={query={ql=@title bag}}, fields={_percolator_document_slot=[1]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nTypeScript\n\n\n```typescript\nres = await searchApi.percolate('test_pq', { query: { percolate: { document : { title : 'What a nice bag' } } } } );\n```\n\n``` typescript\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 1,\n \"hits\": [\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149661,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\n\nGo\n\n\n```go\nquery := map[string]interface{} {\"title\": \"what a nice bag\"}\npercolateRequestQuery := manticoreclient.NewPercolateQuery(query)\npercolateRequest := manticoreclient.NewPercolateRequest(percolateRequestQuery)\nres, _, _ := apiClient.SearchAPI.Percolate(context.Background(), \"test_pq\").PercolateRequest(*percolateRequest).Execute()\n\n```\n\n``` go\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 1,\n \"hits\": [\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149661,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\n\n\n\n\n##### How about multiple documents?\n\nNote that with `CALL PQ`, you can provide multiple documents in different ways:\n\n* as an array of plain documents in round brackets `('doc1', 'doc2')`. This requires `0 as docs_json`\n* as an array of JSONs in round brackets `('{doc1}', '{doc2}')`\n* or as a standard JSON array `'[{doc1}, {doc2}]'`\n\n\nSQL:\n\n\n```sql\nCALL PQ('products', ('nice pair of shoes', 'beautiful bag'), 1 as query, 0 as docs_json);\n\nCALL PQ('products', ('{\"title\": \"nice pair of shoes\", \"color\": \"red\"}', '{\"title\": \"beautiful bag\"}'), 1 as query);\n\nCALL PQ('products', '[{\"title\": \"nice pair of shoes\", \"color\": \"blue\"}, {\"title\": \"beautiful bag\"}]', 1 as query);\n```\n\n\n```sql\n+---------------------+------------+------+---------+\n| id | query | tags | filters |\n+---------------------+------------+------+---------+\n| 1657852401006149637 | @title bag | | |\n+---------------------+------------+------+---------+\n\n+---------------------+--------------+------+-------------+\n| id | query | tags | filters |\n+---------------------+--------------+------+-------------+\n| 1657852401006149636 | @title shoes | | color='red' |\n| 1657852401006149637 | @title bag | | |\n+---------------------+--------------+------+-------------+\n\n+---------------------+--------------+------+---------------------------+\n| id | query | tags | filters |\n+---------------------+--------------+------+---------------------------+\n| 1657852401006149635 | @title shoes | | color IN ('blue, 'green') |\n| 1657852401006149637 | @title bag | | |\n+---------------------+--------------+------+---------------------------+\n```\n\nJSON:\n\n\n```json\nPOST /pq/products/search\n{\n \"query\": {\n \"percolate\": {\n \"documents\": [\n {\"title\": \"nice pair of shoes\", \"color\": \"blue\"},\n {\"title\": \"beautiful bag\"}\n ]\n }\n }\n}\n```\n\n\n```json\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 2,\n \"max_score\": 1,\n \"hits\": [\n {\n \"table\": \"products\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149644,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 2\n ]\n }\n },\n {\n \"table\": \"products\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149646,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title shoes\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\nPHP:\n\n\n```php\n$percolate = [\n 'table' => 'products',\n 'body' => [\n 'query' => [\n 'percolate' => [\n 'documents' => [\n ['title' => 'nice pair of shoes','color'=>'blue'],\n ['title' => 'beautiful bag']\n ]\n ]\n ]\n ]\n];\n$client->pq()->search($percolate);\n\n```\n\n\n```php\nArray\n(\n [took] => 23\n [timed_out] =>\n [hits] => Array\n (\n [total] => 2\n [max_score] => 1\n [hits] => Array\n (\n [0] => Array\n (\n [_index] => products\n [_type] => doc\n [_id] => 2810781492890828819\n [_score] => 1\n [_source] => Array\n (\n [query] => Array\n (\n [match] => Array\n (\n [title] => bag\n )\n )\n )\n [fields] => Array\n (\n [_percolator_document_slot] => Array\n (\n [0] => 2\n )\n )\n )\n [1] => Array\n (\n [_index] => products\n [_type] => doc\n [_id] => 2810781492890828821\n [_score] => 1\n [_source] => Array\n (\n [query] => Array\n (\n [match] => Array\n (\n [title] => shoes\n )\n )\n )\n [fields] => Array\n (\n [_percolator_document_slot] => Array\n (\n [0] => 1\n )\n )\n )\n )\n )\n)\n```\n\nPython\n\n\n```python\nsearchApi.percolate('products',{\"query\":{\"percolate\":{\"documents\":[{\"title\":\"nice pair of shoes\",\"color\":\"blue\"},{\"title\":\"beautiful bag\"}]}}})\n```\n\n``` python\n{'hits': {'hits': [{u'_id': u'2811025403043381494',\n u'table': u'products',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'@title bag'}},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [2]}},\n {u'_id': u'2811025403043381496',\n u'table': u'products',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'@title shoes'}},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}}],\n 'total': 2},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n\n```\n\n\nPython-asyncio\n\n\n```python\nawait searchApi.percolate('products',{\"query\":{\"percolate\":{\"documents\":[{\"title\":\"nice pair of shoes\",\"color\":\"blue\"},{\"title\":\"beautiful bag\"}]}}})\n```\n\n``` python\n{'hits': {'hits': [{u'_id': u'2811025403043381494',\n u'table': u'products',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'@title bag'}},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [2]}},\n {u'_id': u'2811025403043381496',\n u'table': u'products',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'@title shoes'}},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}}],\n 'total': 2},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n\n```\n\n\njavascript\n\n\n```javascript\nres = await searchApi.percolate('products',{\"query\":{\"percolate\":{\"documents\":[{\"title\":\"nice pair of shoes\",\"color\":\"blue\"},{\"title\":\"beautiful bag\"}]}}});\n```\n\n``` javascript\n{\n \"took\": 6,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 2,\n \"hits\": [\n {\n \"table\": \"products\",\n \"_type\": \"doc\",\n \"_id\": 2811045522851233808,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 2\n ]\n }\n },\n {\n \"table\": \"products\",\n \"_type\": \"doc\",\n \"_id\": 2811045522851233810,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title shoes\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n\n```\n\n\njava\n\n\n```java\npercolateRequest = new PercolateRequest();\nquery = new HashMap(){{\n put(\"percolate\",new HashMap(){{\n put(\"documents\", new ArrayList(){{\n add(new HashMap(){{\n put(\"title\",\"nice pair of shoes\");\n put(\"color\",\"blue\");\n }});\n add(new HashMap(){{\n put(\"title\",\"beautiful bag\");\n\n }});\n\n }});\n }});\n }};\npercolateRequest.query(query);\nsearchApi.percolate(\"products\",percolateRequest);\n\n```\n\n``` java\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 2\n maxScore: 1\n hits: [{_index=products, _type=doc, _id=2811045522851234133, _score=1, _source={query={ql=@title bag}}, fields={_percolator_document_slot=[2]}}, {_index=products, _type=doc, _id=2811045522851234135, _score=1, _source={query={ql=@title shoes}}, fields={_percolator_document_slot=[1]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nC#\n\n\n```clike\nvar doc1 = new Dictionary();\ndoc1.Add(\"title\",\"nice pair of shoes\");\ndoc1.Add(\"color\",\"blue\");\nvar doc2 = new Dictionary();\ndoc2.Add(\"title\",\"beautiful bag\");\nvar docs = new List {doc1, doc2};\nDictionary percolateDoc = new Dictionary {{ \"documents\", docs }};\nDictionary query = new Dictionary {{ \"percolate\", percolateDoc }};\nPercolateRequest percolateRequest = new PercolateRequest(query=query);\nsearchApi.Percolate(\"products\",percolateRequest);\n```\n\n``` clike\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 2\n maxScore: 1\n hits: [{_index=products, _type=doc, _id=2811045522851234133, _score=1, _source={query={ql=@title bag}}, fields={_percolator_document_slot=[2]}}, {_index=products, _type=doc, _id=2811045522851234135, _score=1, _source={query={ql=@title shoes}}, fields={_percolator_document_slot=[1]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nRust\n\n\n```rust\nlet mut percolate_doc_fields1 = HashMap::new();\npercolate_doc_fields1.insert(\"title\".to_string(), \"nice pair of shoes\");\npercolate_doc_fields1.insert(\"color\".to_string(), \"blue\");\nlet mut percolate_doc_fields2 = HashMap::new();\npercolate_doc_fields2.insert(\"title\".to_string(), \"beautiful bag\");\nlet mut percolate_doc_fields_list: [HashMap; 2] = [percolate_doc_fields1, percolate_doc_fields2];\nlet mut percolate_doc = HashMap::new();\npercolate_doc.insert(\"documents\".to_string(), percolate_doc_fields_list);\nlet percolate_query = PercolateRequestQuery::new(serde_json::json!(percolate_doc));\nlet percolate_req = PercolateRequest::new(percolate_query);\nsearch_api.percolate(\"products\", percolate_req).await;\n```\n\n``` rust\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 2\n maxScore: 1\n hits: [{_index=products, _type=doc, _id=2811045522851234133, _score=1, _source={query={ql=@title bag}}, fields={_percolator_document_slot=[2]}}, {_index=products, _type=doc, _id=2811045522851234135, _score=1, _source={query={ql=@title shoes}}, fields={_percolator_document_slot=[1]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nTypeScript\n\n\n```typescript\ndocs = [ {title : 'What a nice bag'}, {title : 'Really nice shoes'} ];\nres = await searchApi.percolate('test_pq', { query: { percolate: { documents : docs } } } );\n```\n\n``` typescript\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 2,\n \"hits\": [\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149661,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n },\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149662,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title shoes\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\n\nGo\n\n\n```go\ndoc1 := map[string]interface{} {\"title\": \"What a nice bag\"}\ndoc2 := map[string]interface{} {\"title\": \"Really nice shoes\"}\nquery := []interface{} {doc1, doc2}\npercolateRequestQuery := manticoreclient.NewPercolateQuery(query)\npercolateRequest := manticoreclient.NewPercolateRequest(percolateRequestQuery)\nres, _, _ := apiClient.SearchAPI.Percolate(context.Background(), \"test_pq\").PercolateRequest(*percolateRequest).Execute()\n\n```\n\n``` go\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 2,\n \"hits\": [\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149661,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n },\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149662,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title shoes\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\n\n\n\n##### I want to know what docs match what rules\n\nUsing the option `1 as docs` allows you to see which documents of the provided ones match which rules.\n\nSQL:\n\n\n```sql\nCALL PQ('products', '[{\"title\": \"nice pair of shoes\", \"color\": \"blue\"}, {\"title\": \"beautiful bag\"}]', 1 as query, 1 as docs);\n```\n\n\n\n```sql\n+---------------------+-----------+--------------+------+---------------------------+\n| id | documents | query | tags | filters |\n+---------------------+-----------+--------------+------+---------------------------+\n| 1657852401006149635 | 1 | @title shoes | | color IN ('blue, 'green') |\n| 1657852401006149637 | 2 | @title bag | | |\n+---------------------+-----------+--------------+------+---------------------------+\n```\n\nJSON:\n\n\n```json\nPOST /pq/products/search\n{\n \"query\": {\n \"percolate\": {\n \"documents\": [\n {\"title\": \"nice pair of shoes\", \"color\": \"blue\"},\n {\"title\": \"beautiful bag\"}\n ]\n }\n }\n}\n```\n\n\n```json\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 2,\n \"max_score\": 1,\n \"hits\": [\n {\n \"table\": \"products\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149644,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 2\n ]\n }\n },\n {\n \"table\": \"products\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149646,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title shoes\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\nPHP:\n\n\n```php\n$percolate = [\n 'table' => 'products',\n 'body' => [\n 'query' => [\n 'percolate' => [\n 'documents' => [\n ['title' => 'nice pair of shoes','color'=>'blue'],\n ['title' => 'beautiful bag']\n ]\n ]\n ]\n ]\n];\n$client->pq()->search($percolate);\n\n```\n\n\n```php\nArray\n(\n [took] => 23\n [timed_out] =>\n [hits] => Array\n (\n [total] => 2\n [max_score] => 1\n [hits] => Array\n (\n [0] => Array\n (\n [_index] => products\n [_type] => doc\n [_id] => 2810781492890828819\n [_score] => 1\n [_source] => Array\n (\n [query] => Array\n (\n [match] => Array\n (\n [title] => bag\n )\n )\n )\n [fields] => Array\n (\n [_percolator_document_slot] => Array\n (\n [0] => 2\n )\n )\n )\n [1] => Array\n (\n [_index] => products\n [_type] => doc\n [_id] => 2810781492890828821\n [_score] => 1\n [_source] => Array\n (\n [query] => Array\n (\n [match] => Array\n (\n [title] => shoes\n )\n )\n )\n [fields] => Array\n (\n [_percolator_document_slot] => Array\n (\n [0] => 1\n )\n )\n )\n )\n )\n)\n```\n\nPython\n\n\n```python\nsearchApi.percolate('products',{\"query\":{\"percolate\":{\"documents\":[{\"title\":\"nice pair of shoes\",\"color\":\"blue\"},{\"title\":\"beautiful bag\"}]}}})\n```\n\n``` python\n{'hits': {'hits': [{u'_id': u'2811025403043381494',\n u'table': u'products',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'@title bag'}},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [2]}},\n {u'_id': u'2811025403043381496',\n u'table': u'products',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'@title shoes'}},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}}],\n 'total': 2},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n\n```\n\n\nPython-asyncio\n\n\n```python\nawait searchApi.percolate('products',{\"query\":{\"percolate\":{\"documents\":[{\"title\":\"nice pair of shoes\",\"color\":\"blue\"},{\"title\":\"beautiful bag\"}]}}})\n```\n\n``` python\n{'hits': {'hits': [{u'_id': u'2811025403043381494',\n u'table': u'products',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'@title bag'}},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [2]}},\n {u'_id': u'2811025403043381496',\n u'table': u'products',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'@title shoes'}},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}}],\n 'total': 2},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n\n```\n\n\njavascript\n\n\n```javascript\nres = await searchApi.percolate('products',{\"query\":{\"percolate\":{\"documents\":[{\"title\":\"nice pair of shoes\",\"color\":\"blue\"},{\"title\":\"beautiful bag\"}]}}});\n```\n\n``` javascript\n{\n \"took\": 6,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 2,\n \"hits\": [\n {\n \"table\": \"products\",\n \"_type\": \"doc\",\n \"_id\": 2811045522851233808,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 2\n ]\n }\n },\n {\n \"table\": \"products\",\n \"_type\": \"doc\",\n \"_id\": 2811045522851233810,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title shoes\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\njava\n\n\n```java\npercolateRequest = new PercolateRequest();\nquery = new HashMap(){{\n put(\"percolate\",new HashMap(){{\n put(\"documents\", new ArrayList(){{\n add(new HashMap(){{\n put(\"title\",\"nice pair of shoes\");\n put(\"color\",\"blue\");\n }});\n add(new HashMap(){{\n put(\"title\",\"beautiful bag\");\n\n }});\n\n }});\n }});\n }};\npercolateRequest.query(query);\nsearchApi.percolate(\"products\",percolateRequest);\n\n```\n\n``` java\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 2\n maxScore: 1\n hits: [{_index=products, _type=doc, _id=2811045522851234133, _score=1, _source={query={ql=@title bag}}, fields={_percolator_document_slot=[2]}}, {_index=products, _type=doc, _id=2811045522851234135, _score=1, _source={query={ql=@title shoes}}, fields={_percolator_document_slot=[1]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nC#\n\n\n```clike\nvar doc1 = new Dictionary();\ndoc1.Add(\"title\",\"nice pair of shoes\");\ndoc1.Add(\"color\",\"blue\");\nvar doc2 = new Dictionary();\ndoc2.Add(\"title\",\"beautiful bag\");\nvar docs = new List {doc1, doc2};\nDictionary percolateDoc = new Dictionary {{ \"documents\", docs }};\nDictionary query = new Dictionary {{ \"percolate\", percolateDoc }};\nPercolateRequest percolateRequest = new PercolateRequest(query=query);\nsearchApi.Percolate(\"products\",percolateRequest);\n```\n\n``` clike\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 2\n maxScore: 1\n hits: [{_index=products, _type=doc, _id=2811045522851234133, _score=1, _source={query={ql=@title bag}}, fields={_percolator_document_slot=[2]}}, {_index=products, _type=doc, _id=2811045522851234135, _score=1, _source={query={ql=@title shoes}}, fields={_percolator_document_slot=[1]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nRust\n\n\n```rust\nlet mut percolate_doc_fields1 = HashMap::new();\npercolate_doc_fields1.insert(\"title\".to_string(), \"nice pair of shoes\");\npercolate_doc_fields1.insert(\"color\".to_string(), \"blue\");\nlet mut percolate_doc_fields2 = HashMap::new();\npercolate_doc_fields2.insert(\"title\".to_string(), \"beautiful bag\");\nlet mut percolate_doc_fields_list: [HashMap; 2] = [percolate_doc_fields1, percolate_doc_fields2];\nlet mut percolate_doc = HashMap::new();\npercolate_doc.insert(\"documents\".to_string(), percolate_doc_fields_list);\nlet percolate_query = PercolateRequestQuery::new(serde_json::json!(percolate_doc));\nlet percolate_req = PercolateRequest::new(percolate_query);\nsearch_api.percolate(\"products\", percolate_req).await;\n```\n\n``` rust\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 2\n maxScore: 1\n hits: [{_index=products, _type=doc, _id=2811045522851234133, _score=1, _source={query={ql=@title bag}}, fields={_percolator_document_slot=[2]}}, {_index=products, _type=doc, _id=2811045522851234135, _score=1, _source={query={ql=@title shoes}}, fields={_percolator_document_slot=[1]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nTypeScript\n\n\n```typescript\ndocs = [ {title : 'What a nice bag'}, {title : 'Really nice shoes'} ];\nres = await searchApi.percolate('test_pq', { query: { percolate: { documents : docs } } } );\n```\n\n``` typescript\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 2,\n \"hits\": [\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149661,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n },\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149662,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title shoes\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\n\nGo\n\n\n```go\ndoc1 := map[string]interface{} {\"title\": \"What a nice bag\"}\ndoc2 := map[string]interface{} {\"title\": \"Really nice shoes\"}\nquery := []interface{} {doc1, doc2}\npercolateRequestQuery := manticoreclient.NewPercolateQuery(query)\npercolateRequest := manticoreclient.NewPercolateRequest(percolateRequestQuery)\nres, _, _ := apiClient.SearchAPI.Percolate(context.Background(), \"test_pq\").PercolateRequest(*percolateRequest).Execute()\n\n```\n\n``` go\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 2,\n \"hits\": [\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149661,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n },\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149662,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title shoes\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\n\n\n\n#### Static ids\nBy default, matching document ids correspond to their relative numbers in the list you provide. However, in some cases, each document already has its own id. For this case, there's an option `'id field name' as docs_id` for `CALL PQ`.\n\nNote that if the id cannot be found by the provided field name, the PQ rule will not be shown in the results.\n\nThis option is only available for `CALL PQ` via SQL.\n\n\n##### SQL:\n\n\n\n```sql\nCALL PQ('products', '[{\"id\": 123, \"title\": \"nice pair of shoes\", \"color\": \"blue\"}, {\"id\": 456, \"title\": \"beautiful bag\"}]', 1 as query, 'id' as docs_id, 1 as docs);\n```\n\n\n```sql\n+---------------------+-----------+--------------+------+---------------------------+\n| id | documents | query | tags | filters |\n+---------------------+-----------+--------------+------+---------------------------+\n| 1657852401006149664 | 456 | @title bag | | |\n| 1657852401006149666 | 123 | @title shoes | | color IN ('blue, 'green') |\n+---------------------+-----------+--------------+------+---------------------------+\n```\n\n\n\n##### I may have invalid JSONs, please skip them\n\nWhen using CALL PQ with separate JSONs, you can use the option 1 as skip_bad_json to skip any invalid JSONs in the input. In the example below, the 2nd query fails due to an invalid JSON, but the 3rd query avoids the error by using 1 as skip_bad_json. Keep in mind that this option is not available when sending JSON queries over HTTP, as the whole JSON query must be valid in that case.\n\n\nSQL:\n\n\n```sql\nCALL PQ('products', ('{\"title\": \"nice pair of shoes\", \"color\": \"blue\"}', '{\"title\": \"beautiful bag\"}'));\n\nCALL PQ('products', ('{\"title\": \"nice pair of shoes\", \"color\": \"blue\"}', '{\"title\": \"beautiful bag}'));\n\nCALL PQ('products', ('{\"title\": \"nice pair of shoes\", \"color\": \"blue\"}', '{\"title\": \"beautiful bag}'), 1 as skip_bad_json);\n```\n\n\n```sql\n+---------------------+\n| id |\n+---------------------+\n| 1657852401006149635 |\n| 1657852401006149637 |\n+---------------------+\n\nERROR 1064 (42000): Bad JSON objects in strings: 2\n\n+---------------------+\n| id |\n+---------------------+\n| 1657852401006149635 |\n+---------------------+\n```\n\n\n\n##### I want higher performance of a percolate query\nPercolate queries are designed with high throughput and large data volumes in mind. To optimize performance for lower latency and higher throughput, consider the following.\n\nThere are two modes of distribution for a percolate table and how a percolate query can work against it:\n\n* **Sparse (default).** Ideal for: many documents, mirrored PQ tables. When your document set is large but the set of queries stored in the PQ table is small, the sparse mode is beneficial. In this mode, the batch of documents you pass will be divided among the number of agents, so each node processes only a portion of the documents from your request. Manticore splits your document set and distributes chunks among the mirrors. Once the agents have finished processing the queries, Manticore collects and merges the results, returning a final query set as if it came from a single table. Use [replication](../References.md#Replication) to assist the process.\n* **Sharded.** Ideal for: many PQ rules, rules split among PQ tables. In this mode, the entire document set is broadcast to all tables of the distributed PQ table without initially splitting the documents. This is beneficial when pushing a relatively small set of documents, but the number of stored queries is large. In this case, it's more appropriate to store only a portion of PQ rules on each node and then merge the results returned from the nodes that process the same set of documents against different sets of PQ rules. This mode must be explicitly set, as it implies an increase in network payload and expects tables with different PQs, which [replication](../References.md#Replication) cannot do out-of-the-box.\n\nAssume you have table `pq_d2` defined as:\n\n``` ini\ntable pq_d2\n{\n type = distributed\n agent = 127.0.0.1:6712:pq\n agent = 127.0.0.1:6712:ptitle\n}\n```\n\n\nEach of 'pq' and 'ptitle' contains:\n\n\n\n##### SQL:\n\n\n\n```sql\nSELECT * FROM pq;\n```\n\n\n\n```sql\n+------+-------------+------+-------------------+\n| id | query | tags | filters |\n+------+-------------+------+-------------------+\n| 1 | filter test | | gid>=10 |\n| 2 | angry | | gid>=10 OR gid<=3 |\n+------+-------------+------+-------------------+\n2 rows in set (0.01 sec)\n```\n\n\n\n```json\nPOST /pq/pq/search\n```\n\n\n\n```json\n{\n \"took\":0,\n \"timed_out\":false,\n \"hits\":{\n \"total\":2,\n \"hits\":[\n {\n \"_id\": 1,\n \"_score\":1,\n \"_source\":{\n \"query\":{ \"ql\":\"filter test\" },\n \"tags\":\"\",\n \"filters\":\"gid>=10\"\n }\n },\n {\n \"_id\": 2,\n \"_score\":1,\n \"_source\":{\n \"query\":{\"ql\":\"angry\"},\n \"tags\":\"\",\n \"filters\":\"gid>=10 OR gid<=3\"\n }\n }\n ]\n }\n}\n```\n\n\n\n```php\n$params = [\n 'table' => 'pq',\n 'body' => [\n ]\n];\n$response = $client->pq()->search($params);\n```\n\n\n\n```php\n(\n [took] => 0\n [timed_out] =>\n [hits] =>\n (\n [total] => 2\n [hits] =>\n (\n [0] =>\n (\n [_id] => 1\n [_score] => 1\n [_source] =>\n (\n [query] =>\n (\n [ql] => filter test\n )\n [tags] =>\n [filters] => gid>=10\n )\n ),\n [1] =>\n (\n [_id] => 1\n [_score] => 1\n [_source] =>\n (\n [query] =>\n (\n [ql] => angry\n )\n [tags] =>\n [filters] => gid>=10 OR gid<=3\n )\n )\n )\n )\n)\n```\n\nPython\n\n\n```python\nsearchApi.search({\"table\":\"pq\",\"query\":{\"match_all\":{}}})\n```\n\n``` python\n{'hits': {'hits': [{u'_id': u'2811025403043381501',\n u'_score': 1,\n u'_source': {u'filters': u\"gid>=10\",\n u'query': u'filter test',\n u'tags': u''}},\n {u'_id': u'2811025403043381502',\n u'_score': 1,\n u'_source': {u'filters': u\"gid>=10 OR gid<=3\",\n u'query': u'angry',\n u'tags': u''}}],\n 'total': 2},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n```\n\n\nPython-asyncio\n\n\n```python\nawait searchApi.search({\"table\":\"pq\",\"query\":{\"match_all\":{}}})\n```\n\n``` python\n{'hits': {'hits': [{u'_id': u'2811025403043381501',\n u'_score': 1,\n u'_source': {u'filters': u\"gid>=10\",\n u'query': u'filter test',\n u'tags': u''}},\n {u'_id': u'2811025403043381502',\n u'_score': 1,\n u'_source': {u'filters': u\"gid>=10 OR gid<=3\",\n u'query': u'angry',\n u'tags': u''}}],\n 'total': 2},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n```\n\n\njavascript\n\n\n```javascript\nres = await searchApi.search({\"table\":\"pq\",\"query\":{\"match_all\":{}}});\n```\n\n``` javascript\n{'hits': {'hits': [{u'_id': u'2811025403043381501',\n u'_score': 1,\n u'_source': {u'filters': u\"gid>=10\",\n u'query': u'filter test',\n u'tags': u''}},\n {u'_id': u'2811025403043381502',\n u'_score': 1,\n u'_source': {u'filters': u\"gid>=10 OR gid<=3\",\n u'query': u'angry',\n u'tags': u''}}],\n 'total': 2},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n```\n\njavascript\n\n\n```javascript\nres = await searchApi.search({\"table\":\"pq\",\"query\":{\"match_all\":{}}});\n```\n\n``` javascript\n{\"hits\": {\"hits\": [{\"_id\": 2811025403043381501,\n \"_score\": 1,\n \"_source\": {\"filters\": u\"gid>=10\",\n \"query\": \"filter test\",\n \"tags\": \"\"}},\n {\"_id\": 2811025403043381502,\n \"_score\": 1,\n \"_source\": {\"filters\": u\"gid>=10 OR gid<=3\",\n \"query\": \"angry\",\n \"tags\": \"\"}}],\n \"total\": 2},\n \"timed_out\": false,\n \"took\": 0}\n```\n\n\njava\n\n\n```java\nMap query = new HashMap();\nquery.put(\"match_all\",null);\nSearchRequest searchRequest = new SearchRequest();\nsearchRequest.setIndex(\"pq\");\nsearchRequest.setQuery(query);\nSearchResponse searchResponse = searchApi.search(searchRequest);\n```\n\n``` java\n\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 2\n maxScore: null\n hits: [{_id=2811045522851233962, _score=1, _source={filters=gid>=10, query=filter test, tags=}}, {_id=2811045522851233951, _score=1, _source={filters=gid>=10 OR gid<=3, query=angry,tags=}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nC#\n\n\n```clike\nobject query = new { match_all=null };\nSearchRequest searchRequest = new SearchRequest(\"pq\", query);\nSearchResponse searchResponse = searchApi.Search(searchRequest);\n```\n\n``` clike\n\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 2\n maxScore: null\n hits: [{_id=2811045522851233962, _score=1, _source={filters=gid>=10, query=filter test, tags=}}, {_id=2811045522851233951, _score=1, _source={filters=gid>=10 OR gid<=3, query=angry,tags=}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nRust\n\n\n```rust\nlet query = SearchQuery::new();\nlet search_req = SearchRequest {\n table: \"pq\".to_string(),\n query: Some(Box::new(query)),\n ..Default::default(),\n};\nlet search_res = search_api.search(search_req).await;\n```\n\n``` rust\n\nclass SearchResponse {\n took: 0\n timedOut: false\n hits: class SearchResponseHits {\n total: 2\n maxScore: null\n hits: [{_id=2811045522851233962, _score=1, _source={filters=gid>=10, query=filter test, tags=}}, {_id=2811045522851233951, _score=1, _source={filters=gid>=10 OR gid<=3, query=angry,tags=}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nTypeScript\n\n\n```typescript\nres = await searchApi.search({\"table\":\"test_pq\",\"query\":{\"match_all\":{}}});\n```\n\n``` typescript\n{\n\t'hits':\n\t{\n\t\t'hits':\n\t\t[{\n\t\t\t'_id': '2811025403043381501',\n '_score': 1,\n '_source':\n {\n \t'filters': \"gid>=10\",\n 'query': 'filter test',\n 'tags': ''\n }\n },\n {\n \t'_id':\n \t'2811025403043381502',\n '_score': 1,\n '_source':\n {\n \t'filters': \"gid>=10 OR gid<=3\",\n 'query': 'angry',\n 'tags': ''\n }\n }],\n \t'total': 2\n\t},\n\t'profile': None,\n\t'timed_out': False,\n\t'took': 0\n}\n```\n\n\nGo\n\n\n```go\nquery := map[string]interface{} {}\npercolateRequestQuery := manticoreclient.NewPercolateRequestQuery(query)\npercolateRequest := manticoreclient.NewPercolateRequest(percolateRequestQuery)\nres, _, _ := apiClient.SearchAPI.Percolate(context.Background(), \"test_pq\").PercolateRequest(*percolateRequest).Execute()\n```\n\n``` go\n{\n\t'hits':\n\t{\n\t\t'hits':\n\t\t[{\n\t\t\t'_id': '2811025403043381501',\n '_score': 1,\n '_source':\n {\n \t'filters': \"gid>=10\",\n 'query': 'filter test',\n 'tags': ''\n }\n },\n {\n \t'_id':\n \t'2811025403043381502',\n '_score': 1,\n '_source':\n {\n \t'filters': \"gid>=10 OR gid<=3\",\n 'query': 'angry',\n 'tags': ''\n }\n }],\n \t'total': 2\n\t},\n\t'profile': None,\n\t'timed_out': False,\n\t'took': 0\n}\n```\n\n\n\n\n\n\nAnd you execute `CALL PQ` on the distributed table with a couple of documents.\n\n\n\n##### SQL:\n\n\n\n```sql\nCALL PQ ('pq_d2', ('{\"title\":\"angry test\", \"gid\":3 }', '{\"title\":\"filter test doc2\", \"gid\":13}'), 1 AS docs);\n```\n\n\n\n```sql\n+------+-----------+\n| id | documents |\n+------+-----------+\n| 1 | 2 |\n| 2 | 1 |\n+------+-----------+\n```\n\n\n\n```json\nPOST /pq/pq/search -d '\n\"query\":\n{\n \"percolate\":\n {\n \"documents\" : [\n { \"title\": \"angry test\", \"gid\": 3 },\n { \"title\": \"filter test doc2\", \"gid\": 13 }\n ]\n }\n}\n'\n```\n\n\n\n```json\n{\n \"took\":0,\n \"timed_out\":false,\n \"hits\":{\n \"total\":2,\"hits\":[\n {\n \"_id\": 2,\n \"_score\":1,\n \"_source\":{\n \"query\":{\"title\":\"angry\"},\n \"tags\":\"\",\n \"filters\":\"gid>=10 OR gid<=3\"\n }\n }\n {\n \"_id\": 1,\n \"_score\":1,\n \"_source\":{\n \"query\":{\"ql\":\"filter test\"},\n \"tags\":\"\",\n \"filters\":\"gid>=10\"\n }\n },\n ]\n }\n}\n```\n\n\n\n```php\n$params = [\n 'table' => 'pq',\n 'body' => [\n 'query' => [\n 'percolate' => [\n 'documents' => [\n [\n 'title'=>'angry test',\n 'gid' => 3\n ],\n [\n 'title'=>'filter test doc2',\n 'gid' => 13\n ],\n ]\n ]\n ]\n ]\n];\n$response = $client->pq()->search($params);\n```\n\n\n\n```php\n(\n [took] => 0\n [timed_out] =>\n [hits] =>\n (\n [total] => 2\n [hits] =>\n (\n [0] =>\n (\n [_index] => pq\n [_type] => doc\n [_id] => 2\n [_score] => 1\n [_source] =>\n (\n [query] =>\n (\n [ql] => angry\n )\n [tags] =>\n [filters] => gid>=10 OR gid<=3\n ),\n [fields] =>\n (\n [_percolator_document_slot] =>\n (\n [0] => 1\n )\n\n )\n ),\n [1] =>\n (\n [_index] => pq\n [_id] => 1\n [_score] => 1\n [_source] =>\n (\n [query] =>\n (\n [ql] => filter test\n )\n [tags] =>\n [filters] => gid>=10\n )\n [fields] =>\n (\n [_percolator_document_slot] =>\n (\n [0] => 0\n )\n\n )\n )\n )\n )\n)\n```\n\nPython\n\n\n```python\nsearchApi.percolate('pq',{\"percolate\":{\"documents\":[{\"title\":\"angry test\",\"gid\":3},{\"title\":\"filter test doc2\",\"gid\":13}]}})\n```\n\n``` python\n{'hits': {'hits': [{u'_id': u'2811025403043381480',\n u'table': u'pq',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'angry'},u'tags':u'',u'filters':u\"gid>=10 OR gid<=3\"},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}},\n {u'_id': u'2811025403043381501',\n u'table': u'pq',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'filter test'},u'tags':u'',u'filters':u\"gid>=10\"},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}}],\n 'total': 2},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n```\n\n\nPython-asyncio\n\n\n```python\nawait searchApi.percolate('pq',{\"percolate\":{\"documents\":[{\"title\":\"angry test\",\"gid\":3},{\"title\":\"filter test doc2\",\"gid\":13}]}})\n```\n\n``` python\n{'hits': {'hits': [{u'_id': u'2811025403043381480',\n u'table': u'pq',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'angry'},u'tags':u'',u'filters':u\"gid>=10 OR gid<=3\"},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}},\n {u'_id': u'2811025403043381501',\n u'table': u'pq',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'filter test'},u'tags':u'',u'filters':u\"gid>=10\"},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}}],\n 'total': 2},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n```\n\n\njavascript\n\n\n```javascript\nres = await searchApi.percolate('pq',{\"percolate\":{\"documents\":[{\"title\":\"angry test\",\"gid\":3},{\"title\":\"filter test doc2\",\"gid\":13}]}});\n```\n\n``` javascript\n{'hits': {'hits': [{u'_id': u'2811025403043381480',\n u'table': u'pq',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'angry'},u'tags':u'',u'filters':u\"gid>=10 OR gid<=3\"},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}},\n {u'_id': u'2811025403043381501',\n u'table': u'pq',\n u'_score': u'1',\n u'_source': {u'query': {u'ql': u'filter test'},u'tags':u'',u'filters':u\"gid>=10\"},\n u'_type': u'doc',\n u'fields': {u'_percolator_document_slot': [1]}}],\n 'total': 2},\n 'profile': None,\n 'timed_out': False,\n 'took': 0}\n```\n\njava\n\n\n```java\npercolateRequest = new PercolateRequest();\nquery = new HashMap(){{\n put(\"percolate\",new HashMap(){{\n put(\"documents\", new ArrayList(){{\n add(new HashMap(){{\n put(\"title\",\"angry test\");\n put(\"gid\",3);\n }});\n add(new HashMap(){{\n put(\"title\",\"filter test doc2\");\n put(\"gid\",13);\n }});\n }});\n }});\n}};\npercolateRequest.query(query);\nsearchApi.percolate(\"pq\",percolateRequest);\n```\n\n``` java\nclass SearchResponse {\n took: 10\n timedOut: false\n hits: class SearchResponseHits {\n total: 2\n maxScore: 1\n hits: [{_index=pq, _type=doc, _id=2811045522851234165, _score=1, _source={query={ql=@title angry}}, fields={_percolator_document_slot=[1]}}, {_index=pq, _type=doc, _id=2811045522851234166, _score=1, _source={query={ql=@title filter test doc2}}, fields={_percolator_document_slot=[2]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nC#\n\n\n```clike\nvar doc1 = new Dictionary();\ndoc1.Add(\"title\",\"angry test\");\ndoc1.Add(\"gid\",3);\nvar doc2 = new Dictionary();\ndoc2.Add(\"title\",\"filter test doc2\");\ndoc2.Add(\"gid\",13);\nvar docs = new List {doc1, doc2};\nDictionary percolateDoc = new Dictionary {{ \"documents\", docs }};\nDictionary query = new Dictionary {{ \"percolate\", percolateDoc }};\nPercolateRequest percolateRequest = new PercolateRequest(query=query);\nsearchApi.Percolate(\"pq\",percolateRequest);\n```\n\n``` clike\nclass SearchResponse {\n took: 10\n timedOut: false\n hits: class SearchResponseHits {\n total: 2\n maxScore: 1\n hits: [{_index=pq, _type=doc, _id=2811045522851234165, _score=1, _source={query={ql=@title angry}}, fields={_percolator_document_slot=[1]}}, {_index=pq, _type=doc, _id=2811045522851234166, _score=1, _source={query={ql=@title filter test doc2}}, fields={_percolator_document_slot=[2]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nRust\n\n\n```rust\nlet mut percolate_doc_fields1 = HashMap::new();\npercolate_doc_fields1.insert(\"title\".to_string(), \"angry test\");\npercolate_doc_fields1.insert(\"gid\".to_string(), 3);\nlet mut percolate_doc_fields2 = HashMap::new();\npercolate_doc_fields2.insert(\"title\".to_string(), \"filter test doc2\");\npercolate_doc_fields2.insert(\"gid\".to_string(), 13);\nlet mut percolate_doc_fields_list: [HashMap; 2] = [percolate_doc_fields1, percolate_doc_fields2];\nlet mut percolate_doc = HashMap::new();\npercolate_doc.insert(\"documents\".to_string(), percolate_doc_fields_list);\nlet percolate_query = PercolateRequestQuery::new(serde_json::json!(percolate_doc));\nlet percolate_req = PercolateRequest::new(percolate_query);\nsearch_api.percolate(\"pq\", percolate_req).await;\n```\n\n``` rust\nclass SearchResponse {\n took: 10\n timedOut: false\n hits: class SearchResponseHits {\n total: 2\n maxScore: 1\n hits: [{_index=pq, _type=doc, _id=2811045522851234165, _score=1, _source={query={ql=@title angry}}, fields={_percolator_document_slot=[1]}}, {_index=pq, _type=doc, _id=2811045522851234166, _score=1, _source={query={ql=@title filter test doc2}}, fields={_percolator_document_slot=[2]}}]\n aggregations: null\n }\n profile: null\n}\n\n```\n\n\nTypeScript\n\n\n```typescript\ndocs = [ {title : 'What a nice bag'}, {title : 'Really nice shoes'} ];\nres = await searchApi.percolate('test_pq', { query: { percolate: { documents : docs } } } );\n```\n\n``` typescript\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 2,\n \"hits\": [\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149661,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n },\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149662,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title shoes\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\n\nGo\n\n\n```go\ndoc1 := map[string]interface{} {\"title\": \"What a nice bag\"}\ndoc2 := map[string]interface{} {\"title\": \"Really nice shoes\"}\nquery := []interface{} {doc1, doc2}\npercolateRequestQuery := manticoreclient.NewPercolateQuery(query)\npercolateRequest := manticoreclient.NewPercolateRequest(percolateRequestQuery)\nres, _, _ := apiClient.SearchAPI.Percolate(context.Background(), \"test_pq\").PercolateRequest(*percolateRequest).Execute()\n\n```\n\n``` go\n{\n \"took\": 0,\n \"timed_out\": false,\n \"hits\": {\n \"total\": 2,\n \"hits\": [\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149661,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title bag\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n },\n {\n \"table\": \"test_pq\",\n \"_type\": \"doc\",\n \"_id\": 1657852401006149662,\n \"_score\": \"1\",\n \"_source\": {\n \"query\": {\n \"ql\": \"@title shoes\"\n }\n },\n \"fields\": {\n \"_percolator_document_slot\": [\n 1\n ]\n }\n }\n ]\n }\n}\n```\n\n\n\nIn the previous example, we used the default **sparse** mode. To demonstrate the **sharded** mode, let's create a distributed PQ table consisting of 2 local PQ tables and add 2 documents to \"products1\" and 1 document to \"products2\":\n```sql\ncreate table products1(title text, color string) type='pq';\ncreate table products2(title text, color string) type='pq';\ncreate table products_distributed type='distributed' local='products1' local='products2';\n\nINSERT INTO products1(query) values('@title bag');\nINSERT INTO products1(query,filters) values('@title shoes', 'color=\\'red\\'');\nINSERT INTO products2(query,filters) values('@title shoes', 'color in (\\'blue\\', \\'green\\')');\n```\n\n\nNow, if you add `'sharded' as mode` to `CALL PQ`, it will send the documents to all the agent's tables (in this case, just local tables, but they can be remote to utilize external hardware). This mode is not available via the JSON interface.\n\n\nSQL:\n\n\n```sql\nCALL PQ('products_distributed', ('{\"title\": \"nice pair of shoes\", \"color\": \"blue\"}', '{\"title\": \"beautiful bag\"}'), 'sharded' as mode, 1 as query);\n```\n\n\n```sql\n+---------------------+--------------+------+---------------------------+\n| id | query | tags | filters |\n+---------------------+--------------+------+---------------------------+\n| 1657852401006149639 | @title bag | | |\n| 1657852401006149643 | @title shoes | | color IN ('blue, 'green') |\n+---------------------+--------------+------+---------------------------+\n```\n\n\n\nNote that the syntax of agent mirrors in the configuration (when several hosts are assigned to one `agent` line, separated with `|`) has nothing to do with the `CALL PQ` query mode. Each `agent` always represents **one** node, regardless of the number of HA mirrors specified for that agent.\n\n\n##### How can I learn more about performance?\nIn some cases, you might want to get more details about the performance of a percolate query. For that purpose, there is the option `1 as verbose`, which is only available via SQL and allows you to save more performance metrics. You can see them using the `SHOW META` query, which you can run after `CALL PQ`. See [SHOW META](../Node_info_and_management/SHOW_META.md) for more info.\n\n\n1 as verbose:\n\n\n```sql\nCALL PQ('products', ('{\"title\": \"nice pair of shoes\", \"color\": \"blue\"}', '{\"title\": \"beautiful bag\"}'), 1 as verbose); show meta;\n```\n\n\n```sql\n+---------------------+\n| id |\n+---------------------+\n| 1657852401006149644 |\n| 1657852401006149646 |\n+---------------------+\n+-------------------------+-----------+\n| Variable name | Value |\n+-------------------------+-----------+\n| total | 0.000 sec |\n| setup | 0.000 sec |\n| queries_matched | 2 |\n| queries_failed | 0 |\n| document_matched | 2 |\n| total_queries_stored | 3 |\n| term_only_queries | 3 |\n| fast_rejected_queries | 0 |\n| time_per_query | 27, 10 |\n| time_of_matched_queries | 37 |\n+-------------------------+-----------+\n```\n\n0 as verbose (default):\n\n\n```sql\nCALL PQ('products', ('{\"title\": \"nice pair of shoes\", \"color\": \"blue\"}', '{\"title\": \"beautiful bag\"}'), 0 as verbose); show meta;\n```\n\n\n```sql\n+---------------------+\n| id |\n+---------------------+\n| 1657852401006149644 |\n| 1657852401006149646 |\n+---------------------+\n+-----------------------+-----------+\n| Variable name | Value |\n+-----------------------+-----------+\n| total | 0.000 sec |\n| queries_matched | 2 |\n| queries_failed | 0 |\n| document_matched | 2 |\n| total_queries_stored | 3 |\n| term_only_queries | 3 |\n| fast_rejected_queries | 0 |\n+-----------------------+-----------+\n```\n\n\n\n", "updated_at": 1768530797, "source_md5": "8f547b17948997a9088f15a933a11b49" } }