Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ids query raises type missing for array of types #37

Open
Garito opened this issue Oct 6, 2014 · 2 comments
Open

Ids query raises type missing for array of types #37

Garito opened this issue Oct 6, 2014 · 2 comments

Comments

@Garito
Copy link

Garito commented Oct 6, 2014

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

@polyfractal
Copy link
Owner

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 :(

@Garito
Copy link
Author

Garito commented Oct 6, 2014

Try this:

var path = $scope.data.host + "/" + $scope.data.currentIndex + (($scope.data.currentType) ? "/" + $scope.data.currentType : "") + "/_search";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants