Ich sende die folgende elastische Suchabfrage und es verhält sich sehr gut, wenn über URI-Suche gesendet. Aber mit Post mit Body Call - es funktioniert nicht wie erwartet. Bitte geben Sie an, wie Sie die Anfrage korrigieren können.ElasticSearch: Frage Beitrag Körper funktioniert nicht aber URI Suche funktioniert
Dies funktioniert:
GET ANRUF
<someUrl>/elasticsearch/index/_search?q=host:host-0
RESPONSE (beschränkt auf Host-0)
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 128040,
"max_score": 2.0973763,
"hits": [{
"_index": "123"
"_type": "log_message",
"_id": "123",
"_score": 111,
"_source": {
"host": "host-0",
"pid": 333,
"timestamp": "2017-04-06T04:29:44.724Z",
"priority": 7,
"namespace": "syslog",
"msg": "aaaaa"
}
},
"_index": "345"
"_type": "log_message",
"_id": "345",
"_score": 111,
"_source": {
"host": "host-0",
"pid": 333,
"timestamp": "2017-04-06T04:29:44.724Z",
"priority": 7,
"namespace": "syslog",
"msg": "aaaaa"
}
},
.....
}
Das funktioniert nicht:
POST CALL-
<someUrl>/elasticsearch/index/_search
BODY für POST Call:
{
"query" : {
"term" : { "host": "host-0" }
}
}
RESPONSE (nicht begrenzt auf-0 Host)
auf diesen Index{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 128040,
"max_score": 2.0973763,
"hits": [{
"_index": "123"
"_type": "log_message",
"_id": "123",
"_score": 111,
"_source": {
"host": "host-1",
"pid": 333,
"timestamp": "2017-04-06T04:29:44.724Z",
"priority": 7,
"namespace": "syslog",
"msg": "aaaaa"
}
},
"_index": "345"
"_type": "log_message",
"_id": "345",
"_score": 111,
"_source": {
"host": "host-0",
"pid": 333,
"priority": 7,
"namespace": "syslog",
"msg": "aaaaa"
}
},
"_index": "546"
"_type": "log_message",
"_id": "546",
"_score": 111,
"_source": {
"host": "host-0",
"pid": 222,
"priority": 7,
"namespace": "syslog",
"msg": "aaaaa"
}
},
.....
}
The Get GET zurück/Elasticsearch/
"host": {
"type": "string",
"index": "not_analyzed"
},
Wie senden Sie Ihre Anfragen? Mit welchem Kunden? – Val
teilen Sie bitte auch Ihre Schema-Mappings und Version – user3775217
Ich bin neu bei Elasticsearch - wie kann ich die Version und Mapping abrufen? – BabyGroot