使用以下代码,我将数据插入到我的弹性搜索索引中:
var personendaten = {
"vorname": $.trim( $( '#vorname' ).val() ),
"nachname": $.trim( $( '#nachname' ).val() )
};
$.ajax({
type: "POST",
url: 'http://localhost:9200/castingdb/personen',
dataType: 'json',
data: JSON.stringify( personendaten ),
success: function( pid ){
window.location = '?seite=personen&sub=profil&id='+pid;
}
});
在我的成功函数中,我需要来自 elasticsearch 的返回值,它为我提供插入文档的 id。对于 PHP 和 MySQL,有 last_insert_id 函数,我可以在 jQuery 和 elasticsearch 中使用类似的东西吗?