Elasticsearch批量导入.
我需要将产品作为单个项目导入.
我有一个类似于以下内容的json文件:
{
"Products":[
{
"Title":"Product 1",
"Description":"Product 1 Description",
"Size":"Small",
"Location":[
{
"url":"website.com",
"price":"9.99",
"anchor":"Prodcut 1"
}
],
"Images":[
{
"url":"product1.jpg"
}
],
"Slug":"prodcut1"
},
{
"Title":"Product 2",
"Description":"Prodcut 2 Desctiption",
"Size":"large",
"Location":[
{
"url":"website2.com",
"price":"99.94",
"anchor":"Product 2"
},
{
"url":"website3.com",
"price":"79.95",
"anchor":"discount product 2"
}
],
"Images":[
{
"url":"image.jpg"
},
{
"url":"image2.jpg"
}
],
"Slug":"product2"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我试过以下(我是新手):
curl -s -XPOST 'http://localhost:9200/_bulk' --data-binary @products.json
curl -s -XPOST 'http://localhost:9200/_bulk' -d @products.json
curl -XPOST http://localhost:9200/cp/products -d "@products.json"
curl …Run Code Online (Sandbox Code Playgroud) 好的,我有这个代码,我一直用来向我的应用程序吐出新闻.它一直工作到今天.我已经删除了以下代码中的所有逻辑,使其变得简单.但它应该"工作"有人可以帮助我修复这个代码到它工作的地方,并做得对吗?我知道它被黑了,但直到今天它似乎没有任何问题.我没有更新任何东西,不知道这笔交易是什么.
Plugin Name: MyPlugin Example
Version: 1.0.1
If ( ! class_exists("MyPlugin") )
{
class MyPlugin
{
var $db_version = "1.0"; //not used yet
function init()
{
//Nothing as of now.
}
function activate()
{
global $wp_rewrite;
$this->flush_rewrite_rules();
}
function pushoutput( $id )
{
$output->out =' The output worked!';
$this->output( $output );
}
function output( $output )
{
ob_start();
ob_end_clean();
header( 'Cache-Control: no-cache, must-revalidate' );
header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
header( 'Content-type: application/json' ); …Run Code Online (Sandbox Code Playgroud) 我知道在delphi中你可以打开默认浏览器:
ShellExecute(self.WindowHandle,'open','www.website.com',nil,nil, SW_SHOWNORMAL);
Run Code Online (Sandbox Code Playgroud)
但是我想知道是否有办法在新打开的浏览器窗口上自动发布数据或自动填充登录数据(即使在firefox,safari等)
谢谢
-Brad
我有一个同义词列表,需要在SQL中为它创建一个数据库.
我正在考虑使用关系数据库设计,但不知道它是否是最好的.使用此数据库将有相当数量的流量.
我在想Table1会是这样的
Id
Table2
Id
InterlinkID (Table1 Id)
Word
Run Code Online (Sandbox Code Playgroud)
这会是最好的方式吗?可能有1到20个以上的链接词.我从这个设置中看到的另一个问题是如果我有一个单词作为多个单词的同义词.
不太好用它如何使用的例子,但是你明白了:
Table 1
Id 1
Id 2
Table 2
Id 1
InterlinkID 1
Word One
Id 2
InterlinkID 1
Word 1
Id 3
InterlinkID 1
Word First
Id 4
InterlinkID 2
Word Two
Id 5
InterlinkID 2
Word 2
Id 6
InterlinkID 2
Word Second
我正在尝试使用Objective-C为我的Mac重新编写一个Windows应用程序,我希望能够像Mac的热门角落那样做.如果我将鼠标移动到屏幕的左侧,它将显示一个窗口,如果我将它移到窗口位置之外,窗口将再次隐藏.(窗口将被推到屏幕的左侧).
有谁知道我在哪里可以找到一些关于如何做到这一点的演示代码(或参考),或者至少如何判断鼠标在哪里,即使当前应用程序不在顶部.(不知道怎么说这个,太习惯了Windows世界).
谢谢
-Brad
或者允许您以与JQuery类似的方式解析HTML的东西?
如果没有,在您看来,什么是解析HTML的最佳方式,而不必是正则表达式专家,而不是依靠Internet Explorer为您解析信息?(AKA,不依赖于:bsalsa.com的IEParser)
谢谢
-Brad
有更快的方法吗?我基本上需要一次将AA-ZZ添加到数千条记录中.
只需要35个项目的列表就需要很长时间才能完成一千个列表.
procedure Tmainform.btnSeederClick(Sender: TObject);
var
ch,ch2:char;
i:integer;
slist1, slist2:TStrings;
begin
slist1:= TStringList.Create;
slist2:= TStringList.Create;
slist1.Text :=queuebox.Items.Text;
for ch := 'a' to 'z' do
begin
for ch2 := 'a' to 'z' do
begin
//
for I := 0 to slist1.Count - 1 do
begin
application.ProcessMessages; // so it doesn't freeze the application in long loops. Not 100% sure where this should be placed, if at all.
sleep(1); //Without this it doesn't process the cancel button.
if cancel then Break;
slist2.Add(slist1.Strings[i]+ch+ch2); …Run Code Online (Sandbox Code Playgroud) 好吧,我有Idhttp动态创建如下
procedure TForm1.Button1Click(Sender: TObject);
Var
Resp : String;
begin
Resp := webSession('https://www.website.com'); // HTTPS site requires session to keep alive
if Length(Resp)>0 then
MessageDlg('Got the body ok',mtInformation,[mbOk],0);
end;
function TForm1.webSession(sURL : ansistring) : ansistring;
var
SStream : Tstringstream;
HTTPCon : TIdHTTP;
AntiFreeze : TIdAntiFreeze;
CompressorZLib: TIdCompressorZLib;
ConnectionIntercept: TIdConnectionIntercept;
SSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL;
CookieManager: TIdCookieManager;
begin
CompressorZLib := TIdCompressorZLib.Create;
ConnectionIntercept :=TIdConnectionIntercept.Create;
SSLIOHandlerSocketOpenSSL := TIdSSLIOHandlerSocketOpenSSL.Create;
Result := '';
if Length(SettingsForm.edtProxyServer.text) >= 7 then // 0.0.0.0
Try
SStream := NIL;
AntiFreeze := NIL;
HTTPCon …Run Code Online (Sandbox Code Playgroud) 我对基本的MySQL"好",但这是"我的头脑"!
目标:
数据库表是巨大的,速度是一个问题.
没有MyISAM是inoDB会更快吗?每个数据库都在一个唯一的表中.
我被赋予了这个作为我正在尝试做的事情的起点:
CREATE TABLE `table` LIKE LiveTable
LOAD DATA INFILE..... INTO `table`
UPDATE `table` SET delete=1; -- Set the delete field to true because it will not have been updated
UPDATE `table` INNER JOIN`table`ON `LiveTable.ID`=`table.ID`
SET LiveTable.Col1=table.Col1, LiveTable.Col2=table.Col2….. delete=0
INSERT INTO LiveTable(ID,Col1,Col2,… delete=0)
SELECT ID,Col1,Col2,...FROM `table`
LEFT JOIN LiveTable
ON table.ID = LiveTable.ID
WHERE LiveTable.ID IS NULL
DELETE FROM LiveTableWHERE delete = 0
EMPTY TABLE `table`
Run Code Online (Sandbox Code Playgroud)
> CREATE TABLE `product_table` (
> `programname` …Run Code Online (Sandbox Code Playgroud) 我想创建一个能够使用az,0-9生成字母和可选数字列表的函数.
$output = array();
foreach(range('a','z') as $i) {
foreach(range('a','z') as $j) {
foreach(range('a','z') as $k) {
$output[] =$i.$j.$k;
}
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢
例:
myfunction($include, $length)
Run Code Online (Sandbox Code Playgroud)
用法是这样的:
myfunction('a..z,0..9', 3);
Run Code Online (Sandbox Code Playgroud)
输出:
000
001
...
aaa
aab
...
zzz
Run Code Online (Sandbox Code Playgroud)
输出将包含字母和数字的所有可能组合.