提问人:Reddy SK 提问时间:11/11/2022 最后编辑:Reddy SK 更新时间:11/11/2022 访问量:66
数据表 AJAX POST 被弹性拒绝:预期 [START_OBJECT] 但找到 [VALUE_STRING]
Datatables AJAX POST rejected by elastic: Expected [START_OBJECT] but found [VALUE_STRING]
问:
我正在尝试修复与 mu 本地弹性实例的连接,但在尝试使用服务器端调用时仍然出现各种错误。
经过各种尝试,我遇到了“预期 [START_OBJECT] 但发现 [VALUE_STRING]”的情况。
试图通过互联网找到原因和解决方案,但没有成功。
这是我的代码。
<script>
$(document).ready(function () {
var query = '{ "query" : { "match_all" : {} } }';
console.log (query);
query = JSON.stringify(query);
console.log (query);
$('#integrations').DataTable( {
"processing": true,
"serverSide": true,
"ajax": {
"url": "http://localhost:9200/integrations-prod/_search?size=1000&source_content_type=application/json",
//WORKS EVEN WITH GET BUT NOT AS SERVERSIDE "url": `http://czchown5029751.prg-dc.dhl.com:9200/integrations-prod/_search?size=1000&source_content_type=application/json&source=${query}`,
//WORKS EVEN WITH GET BUT NOT AS SERVERSIDE "url": `http://czchown5029751.prg-dc.dhl.com:9200/integrations-prod/_search?size=10000`,
data : function ( d ) {
return query;
},
"contentType": "application/json",
//"cache": "false",
"type": "POST",
//"jsonp": "true",
"dataType": "json",
"dataSrc": "hits.hits",
"columnDefs": [ { "defaultContent": "-", "targets": "_all" } ]
},
"columns": [
{ "data": "_source.name" },
{ "data": "_source.description" },
{ "data": "_source.valid" },
{ "data": "_source.status_id" },
{ "data": "_source.region_id" },
{ "data": "_source.validated_time" }
]
} )
});
</script>
答: 暂无答案
上一个:搜索具有关系值的数据表
评论
"serverSide": true
data : function ( d ) { return query; }
d
console.log( d )
ajax.data
的文档中查看示例。或者,也许您故意想忽略所有用户搜索/排序/分页操作?query
d
"serverSide": true
Showing 0 to 0 of 0 entries (filtered from NaN total entries)