我的索引中有两个映射.其中一个以不同货币存储一些金额,其他商店存储当前转换率.每个记录看起来像这样:
http://localhost:9200/transactions/amount
Run Code Online (Sandbox Code Playgroud)
[{
_index: "transactions",
_type: "amount",
_id: "AVA3fjawwMA2f8TzMTbM",
_score: 1,
_source: {
balance: 1000,
currency:"usd"
}
},
{
_index: "transactions",
_type: "amount",
_id: "AVA3flUWwMA2f8TzMTbN",
_score: 1,
_source: {
balance: 2000,
currency:"inr"
}
}]
Run Code Online (Sandbox Code Playgroud)
和
http://localhost:9200/transactions/conversions
Run Code Online (Sandbox Code Playgroud)
{
_index: "transactions",
_type: "conversions",
_id: "rates",
_score: 1,
_source: {
"usd": 1,
"inr":62.6
}
}
Run Code Online (Sandbox Code Playgroud)
我想amount从conversions单个查询中查询数据并应用当前转换率并获得结果.
我尝试使用脚本化查询,并能够根据传递的参数转换数据,如:
GET _search
Run Code Online (Sandbox Code Playgroud)
{
"query": {
"match_all": {}
},
"script_fields" : {
"test1" : {
"script" : "_source.balance * factor",
"params" : { …Run Code Online (Sandbox Code Playgroud) 当我使用这个时:
case "vic":
if ((bPostcodeSubstring == 3) || (bPostcodeSubstring == 8)){
return true;
}
else{
errMsg += "Enter A Valid Postcode.";
result = false;
}
break;
Run Code Online (Sandbox Code Playgroud)
它工作正常.但是当我使用它时:
case "vic":
if ((bPostcodeSubstring != 3) || (bPostcodeSubstring != 8)){
errMsg += "Enter A Valid Postcode.";
result = false;
}
break;
Run Code Online (Sandbox Code Playgroud)
它根本不起作用.有什么问题?
我不明白为什么单击链接后显示“未定义”。有人知道为什么吗?
let allBlocks = ["one","two"];
for (i = 0; i < allBlocks.length; i++) {
document.body.innerHTML += '<p id="" onclick="test(allBlocks[i])">Link</p>';
}
function test(n){
alert(n);
}
Run Code Online (Sandbox Code Playgroud)