我试图使用jprante的elasticsearch jdbc河索引elasticsearch中的 mysql记录.我刚刚注意到日期字段中的值在索引中发生了变化.
制图:
content_date:{
"type":"date"
}
Run Code Online (Sandbox Code Playgroud)
content_date mysql中记录的字段 - > 2012-10-06 02:11:30
在运行jdbc河之后....
content_date 弹性搜索中相同记录的字段 - > 2012-10-05T20:41:30Z
河:
curl -XPUT 'localhost:9200/_riv_index/_riv_type/_meta' -d '{
"type" : "jdbc",
"jdbc" : {
"driver" : "com.mysql.jdbc.Driver",
"url" : "jdbc:mysql://localhost:3306/db",
"user" : "user",
"password" : "password",
"sql" : "select * from table where id=2409",
"poll" : "1d",
"versioning" : false
},
"index" : {
"index" : "myindex",
"type" : "mytype"
}
}'
Run Code Online (Sandbox Code Playgroud)
日期格式的更改是可以接受的,但为什么日期值会更改?这条河正在为mysql记录的日期添加utc时差并将其保存在elasticsearch中.如何停止此时间转换?
我试图regular expression使用下面的代码验证jQuery中的URL .用它http://www和它一起工作正常https://www
var myVariable = "http://www.example.com/2013/05/test-page-url-512-518.html";
if(/^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/|www\.)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(myVariable)){
alert("valid url");
} else {
alert("invalid url");
}
Run Code Online (Sandbox Code Playgroud)
编辑:-
上面的代码完美地用于验证URL.那个时候我的要求只是验证http://www和https://www
我正在编写一个剧本,我需要在其中执行 mysql 查询并以 json 格式传递输出。剧本代码工作正常,只是我想在字符串concatenate部分遇到错误。如果我传递示例 json 字符串,它工作正常。
- name: Execute php script with json parameter
command: php -f /path/to/php/test.php "{'colors':{'red','blue','yellow'}}"
register: php_output
Run Code Online (Sandbox Code Playgroud)
output.stdout_lines是已在我的剧本中设置的变量,其中包含{'red','blue','yellow'}格式输出。
- name: Execute php script with json parameter
command: php -f /path/to/php/test.php '{"stdout_lines": {{output.stdout_lines}} }'
register: php_output
Run Code Online (Sandbox Code Playgroud)
那么如何output.stdout_lines在 中连接变量'{"stdout_lines": {{output.stdout_lines}} }'?有什么建议
我对布尔查询中“应该”和“必须”的用法有点困惑。当 SHOULD 和 MUST 子句中有多个过滤器时,它们可以放在同一级别还是应该嵌套?
下面是我的数据和我测试的两个查询的简化版本,第一个失败,后者工作。在实际实践中,我有很多“必须”和“应该”的过滤器。
我开始相信,如果想要组合多个 SHOULD 和 MUST 过滤器,那么外部过滤器必须始终是 SHOULD。这是一个正确的假设吗?如果我想使用 MUST_NOT,它应该放在这个上下文中的哪里?
我的数据:
_index,_type,_id,_score,_source.id,_source.type,_source.valueType,_source.sentence,_source.location
"test","var","0","1","0","study","text","Lorem text is jumbled","spain"
"test","var","1","1","1","study","text","bla bla bla","spain"
"test","var","2","1","2","schema","decimal","ipsum","germany"
"test","var","3","1","3","study","integer","lorem","france"
Run Code Online (Sandbox Code Playgroud)
这是失败的查询:
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"bool": {
"must": {
"terms": {
"location": [
"germany"
]
}
},
"should": {
"terms": {
"valueType": [
"integer"
]
}
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的 WORKING 查询,返回 ID 2 和 3:
{
"query": {
"bool": {
"should": [ …Run Code Online (Sandbox Code Playgroud) 我已将joomla和wordpress文件从旧服务器更改为新服务器。在前端和管理端,它的工作没有任何错误。但是在数据库(phpmyadmin)部分中,它显示了一些类似这样的警告消息。
Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings.
You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.
We selected 'Asia/Calcutta' for 'IST/5.0/no DST' instead in /usr/share/phpmyadmin/libraries/db_info.inc.php on line 88
Warning: strftime() [function.strftime]: It is not safe to rely on the system's timezone settings.
You are *required* to use …Run Code Online (Sandbox Code Playgroud) 我试图在jQuery中隐藏第三个子div,但隐藏第一个子div子子。
我正在尝试以下代码:-
HTML:-
<div id="parent-1">
<div id="child-1" class="child">CHILD 1
<div id="sub-child-1" class="subchild">SUB CHILD 1</div>
<div id="sub-child-2" class="subchild">SUB CHILD 2</div>
<div id="sub-child-3" class="subchild">SUB CHILD 3</div>
</div>
<div id="child-2" class="child">CHILD 2</div>
<div id="child-3" class="child">CHILD 3</div>
</div>
Run Code Online (Sandbox Code Playgroud)
jQuery的:-
$(document).ready(function () {
$('div#parent-1 div:eq(2)').css("display", "none");
});
Run Code Online (Sandbox Code Playgroud)
我要藏child-3在这里 但它藏起来了sub-child-3。
这是jsfiddle
有什么建议吗?
提前致谢。
我正在尝试提高查询性能.对于甚至没有触及嵌套文档的简单查询,平均需要大约3秒,并且有时更长.
curl "http://searchbox:9200/global/user/_search?n=0&sort=influence:asc&q=user.name:Bill%20Smith"
Run Code Online (Sandbox Code Playgroud)
即使没有那种,也需要几秒钟.以下是群集的详细信息:
1.4TB index size.
210m documents that aren't nested (About 10kb each)
500m documents in total. (nested documents are small: 2-5 fields).
About 128 segments per node.
3 nodes, m2.4xlarge (-Xmx set to 40g, machine memory is 60g)
3 shards.
Index is on amazon EBS volumes.
Replication 0 (have tried replication 2 with only little improvement)
Run Code Online (Sandbox Code Playgroud)
我没有看到任何明显的CPU /内存等峰值.任何想法如何改进?
我正在使用APScheduler每5分钟运行一次python方法。运行良好。我需要将计划的作业迭代次数限制为100。在100次迭代之后,它应该关闭该过程。我已经检查了参考文件,但找不到任何提供此功能的选项。我们可以选择控制作业实例的数量,但不能控制最大迭代次数。有人对此有想法吗?
from apscheduler.schedulers.blocking import BlockingScheduler
def job():
print "Decorated job"
scheduler = BlockingScheduler()
scheduler.add_job(job, 'interval', minutes=5)
scheduler.start()
Run Code Online (Sandbox Code Playgroud)
或者,如果我获得了计划的作业迭代计数,那么我也可以从代码本身中删除正在运行的作业,如下所示。
scheduler = BlockingScheduler()
scheduler.add_job(job, 'interval', minutes=5, id='my_job_id')
#iterationCount ??
if (iterationCount = 100 ):
scheduler.remove_job('my_job_id')
exit(0)
scheduler.start()
Run Code Online (Sandbox Code Playgroud) 我有一个包含大约 500 个名字的列表的页面。用户想s在他们的键盘上输入例如,然后页面将自动滚动到以 开头的名称s。
我应该将这些名称的第一个字母转换为 an INT,将该 INT 作为数据属性并将 jQuery 函数添加到页面,还是有更好的解决方案?
我有以下问题.有一些PHP行.
在var_dump中$testArrayA,"def"条目test2不存在,因为它是在添加后$testArrayB添加的$testArrayA.
在我看来,在我的情况下,这$testArrayB不是通过引用存储的$testArrayA.我如何根据参考存储它,我需要做什么才能在var_dump中输入"def"条目?
非常感谢提前
$testArrayA = [];
$testArrayB = [];
$testArrayB["ghi"] = "test1";
$testArrayA["abc"] = $testArrayB;
$testArrayB["def"] = "test2";
Run Code Online (Sandbox Code Playgroud)
var_dump:
array(1) {
["abc"]=>
array(1) {
["ghi"]=>
string(5) "test1"
}
}
Run Code Online (Sandbox Code Playgroud)