使用字符串类型的元数据值查询Orion

问题描述 投票:1回答:1

我正在尝试查询Orion版本2.2.0-next,以便返回与不同字符串的元数据值匹配的记录。

我的JSON看起来像这样:

"AttributeName": {
        "type": "String",
        "value": "Some Value",
        "metadata": {
            "AttributeMeta": {
                "type": "String",
                "value": "Some Other Value"
            }
        }
    }

我正在查询Orion,如下所示:http://myip:1026/v2/entities?type=myType&mq=AttributeName.AttributeMeta==Some%20Other%20Value&options=count

不幸的是,退货是空的。

有什么想法,建议吗?

编辑

PHP中的实体创建代码:

$data[] = array("id" => (mktime() + $i)."_$client", "type" => "myType", "datetime" => array("type" => "DateTime", "value" => date("Y-m-d\TH:i:s", mktime($ho, $mi, $se, $mo, $da, $ye))), "Parameter1" => array("type" => "String", "value" => (string)$parameter1), "Parameter2" => array("type" => "Float", "value" => (float)$Parameter2), "Parameter3" => array("type" => "String", "value" => (string)$parameter3, "metadata" => array("Parameter3Meta" => array("type" => "String", "value" => "$parameter3meta"))), "location" => array("type" => "geo:point", "value" => "$lat, $lon"), "range" => array("type" => "Float", "value" => (float)$range), "Parameter4" => array("type" => "String", "value" => (string)$parameter4)); 
curl_setopt($ch, CURLOPT_URL, "http://$ip/v2/entities");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data[$i]));
curl_setopt($ch, CURLOPT_HTTPHEADER, array("fiware-service: $tenant", "fiware-servicepath: /$subtenant", "Content-Type: application/json"));
curl_setopt($ch, CURLOPT_PORT, 1026);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); 
curl_setopt($ch, CURLOPT_TIMEOUT, 400);
$response = curl_exec($ch);

EDIT 2:在上面的查询中,使用了两个标头:fiware-service:租户和fiware-servicepath:/ subtenant

metadata fiware-orion
1个回答
1
投票

尝试删除'type = myType'。目前尚不清楚您要通过查询提取的实体的类型是什么。

© www.soinside.com 2019 - 2024. All rights reserved.