AJAX call - get request shows results of /_search instead of the query


I'm new to Kibana/Elasticsearch and I'm trying to get the data in Elasticsearch in Oracle apex.
To get the data I'm using a AJAX GET request (JSONP, due to the http:// call from https://) to an endpoint, opening this endpoint in the browser works fine, I'm getting everything that is placed in /trefwoorden.

However when I run my code I'm getting a "Uncaught SyntaxError: UnExpected token : " error in Chrome and in the 'Sources' I'm getting a JSON with hits total 40710, meaning that every _id is encountered.

I hope you can tell me whats wrong with the structure of my call or query

I have the following code
var query ={
"query": {
"ids": {
"type": "e_book",
"values": ["9789026333842"]
"_source": ["hoofdtitel"]

    url: "[endpoint]/trefwoorden/_search",
    method: "GET",
    crossDomain: true,
    dataType: 'jsonp',
    contentType: 'application/jsonp',
    success: function(data) {        
    error: function(data) { },
   data: JSON.stringify(query)

This is the result I actually want to get (got this via Kibana):
"took": 0,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
"hits": {
"total": 1,
"max_score": 1,
"hits": [
"_index": "trefwoorden_1",
"_type": "e_book",
"_id": "9789026333842",
"_score": 1,
"_source": {
"hoofdtitel": "Als het zaterdag wordt"

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.