elasticsearch-inquisitor
elasticsearch-inquisitor copied to clipboard
Ids query raises type missing for array of types
Even when the manual says you could pass type as an array for a Ids query: The type is optional and can be omitted, and can also accept an array of values. When I try this query:
{
"query": {
"ids": {
"type": ["project", "task"],
"values": [
"PnnJZF-iRJqUqmP2FptBZw",
"PcCoyqzKQf2ipeV1Ns4iPQ",
"4fNSubM9RMS1BnInrDVoHg"
]
}
}
}
Inquisitor raises "type missing" and doesn't gives you back any result but if I try the same query directly to elasticsearch it works as expected
Yeah, it's because Inquisitor is being very naive about URL generation for queries. E.g this line:
var path = $scope.data.host + "/" + $scope.data.currentIndex + "/" + $scope.data.currentType + "/_search";
Will generate an illegal URL if either type or index is omitted. It needs some extra logic to check if index or type is empty (the data is already stored in $scope.data.typeMissing
and $scope.data.indexMissing
...it just needs to be checked) and then construct the URL appropriately.
Want to send a PR? If not I'll try to fix this when I get a chance, but I'm pretty slogged at work right now...and packing for a cross-country move in the evenings :(
Try this:
var path = $scope.data.host + "/" + $scope.data.currentIndex + (($scope.data.currentType) ? "/" + $scope.data.currentType : "") + "/_search";