를 동작하지 않습니다 :호출 elasticsearch는 간단한 검색에 대해 작동하지만, 나는 내 예상 결과를 얻을 다시 응답에서 다음 코드 구문을 사용하여 탄성에 간단한 쿼리를 보낼 경우 복잡한 검색
webaddress = "http://localhost:9200/" + index + "/_search?q='hello world'"
set xml = server.Createobject("MSXML2.ServerXMLHTTP")
xml.Open "GET", webaddress ,False
xml.setRequestHeader "Authorization", "Basic " & Base64Encode("elastic:elastic123")
xml.Send
을
이제 위와 같이 단일 'q'매개 변수에 쿼리를 배치하는 것이 실제로 가능하지 않거나 심지어 가능하지 않은 훨씬 복잡한 쿼리를 보내려는 경우. 즉
쿼리 :
get myindex/_search
{
"query":{"match": {"headline": "overseas territory"},
"match" : {"bodytext": "british territory"}
}
}
그래서 내가 변수에이를 구축 할 것입니다.
webaddress = "http://localhost:9200/" + index + "/_search"
와는 XML.send이된다 :
xml.Send mySearch
mySearch은 무시됩니다 내가 변수 webaddress에서 10 개 개의 레코드 먼저 기본을 다시받을 내 webaddress이되고 그 다음
을 mySearch 호출 할 수 있습니다.위 검색어는 스크립트에 다음과 같은 방법으로 내장되어 있습니다 : 그것은 인식되도록
Function TermBuilder(query)
dim queryArray
dim termString
queryArray = split(query," ")
termString = "{ ""query"" :{"
For i = LBound(queryArray) to UBound(queryArray)
termString = termString + """match"": {""headline"": """ + queryArray(i) + """ } ,""match"": { ""bodytext"": """ + queryArray(i) + """},"
next
termString = mid(termString, 1, len(termString) - 1) 'remove trailing comma
termString = termString + "}}"
TermBuilder = termString
End Function
가 어떻게 내 복잡한 검색을 통과해야한다. 나는 컬을 사치스럽게 여긴다.
이것은 XML 질문이 아닙니다. 직접 WinHttpRequest를 사용하면 똑같은 문제가 발생합니다. – Bob77
@ Bob77 왜 이것이 XML 질문이라고 생각합니까? 나는 그것에 대해 어떤 단서를 볼 수 없었다. –
메서드를 _POST_로 변경 했습니까? 'xml.Open "POST", webaddress, False' – SearchAndResQ