2016-06-20 14 views
0

Elasticsearch kehrt me "query_parsing_exception", "Grund": error "[bool] Abfrage nicht unterstützt", wenn man versucht die nachschlagen Einträge mit folgenden query.i denken, das Problem über "query_string" istElasticsearch Query unterstützt Query_string nicht?

curl -XGET '<myurl>:<myport>/index/_search?pretty' -d ' 
{ 
    "query": { 
    "bool": { 
     "must":[ { 
      "term" : { 
       "query" : "1.2.3.4", 
       "fields" : [ "ip" ] 
        } 
       },{ 
       "range" : { 
       "localtime" : { 
        "from" : "2016-06-15T06:00:04.923Z", 
        "to" : "2016-06-17T17:43:04.923Z", 
        "include_lower" : true, 
        "include_upper" : true 
           } 
         } 
       }, 
      "query_string" : { 
      "default_field" : "_all", 
      "query" : "word1 OR word1", 

      } ] 
     } 
    } 
}' 

Warum erscheint dieser Fehler?

Dank


Anyhelp wird geschätzt! Vielen Dank!

Antwort

3

Es hilft normalerweise, Ihre Abfragen richtig zu formatieren. In Ihrem Fall fehlt eine geschweifte Klammer vor query_string und Sie haben ein zu viel Komma nach Ihrer query_string Abfrage.

wie diese Umformatierung funktioniert:

curl -XGET '<myurl>:<myport>/index/_search?pretty' -d ' 
{ 
    "query": { 
    "bool": { 
     "must": [ 
     { 
      "term": { 
      "ip": "1.2.3.4" 
      } 
     }, 
     { 
      "range": { 
      "localtime": { 
       "from": "2016-06-15T06:00:04.923Z", 
       "to": "2016-06-17T17:43:04.923Z", 
       "include_lower": true, 
       "include_upper": true 
      } 
      } 
     }, 
     { 
      "query_string": { 
      "default_field": "_all", 
      "query": "word1 OR word1" 
      } 
     } 
     ] 
    } 
    } 
}' 
+0

bekam die Fehlermeldung: „Grund“: „[Begriff] Abfrage nicht unterstützt Array von Werten“, –

+0

Ich habe meine Antwort aktualisiert. – Val

+0

Val, würden Sie mir helfen, das Problem zu lösen http://stackoverflow.com/questions/37925507/elasticsearch-how-to-get-distinct-value-from-two-indeices-in-php-client –

Verwandte Themen