How do I construct complex queries to pass via rest

HI All,

I'm using classic asp. Using the following simple example I am able to obtain data back to the asp application from elasticsearch:

Response.Buffer = true
	dim xml, toScreen 
	dim txt

	Set xml = Server.CreateObject("Microsoft.XMLHTTP")

	xml.Open "GET", "http://username:password@10.128.128.106:9200/myindex/_search?q='joe blogs',_source='path.real'", False
xml.Send

I now want to perform this type of query that I formulated directly in Kibana across rest. How do I create this as a search string for the above? :

  GET newsindex/_search
{
"query": {
"function_score": {
  "query": { "bool" : {"should": [ 
   { "term": { "headline": "brown" } },
   { "term": {  "bodytext": "brown" } },
   { "term": { "headline": "fox" } },
   { "term": { "bodytext": "fox" } }
]}},
  "functions": [
    {
      "filter": {"match" : { "headline": "brown fox" }},
      "weight": 2
    },
    {
      "filter": {"match" : { "bodytext": "brown fox" }},
      "weight": 1
    },
    {
      "filter": {"match" : { "bodytext": "fox" }},
      "weight": 3
    },
    {
      "filter": {"match" : { "bodytext": "brown" }},
      "weight": 3
    },
    {
      "filter": {"match" : { "headline": "brown" }},
      "weight": 4
    },
    {
      "filter": {"match" : { "headline": "fox" }},
      "weight": 4
    }
    ],
  "score_mode": "sum"
}
},"sort": [
{
  "_score": {
    "order": "asc"
  }
}
], 
"_source":[ "headline", "bodytext" ]
}

I've managed to figure it out.

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