将 Elasticsearch kibana 查询字符串格式转换为 URI 搜索格式

Convert Elasticsearch kibana query string format to URI Search format

从上周开始,我开始使用 AWS 上的 Elastic Search Service。我当前的 Elasticseach 版本是 6.X.X 和 Kibana 6.X.X,现在我对 Kibana 客户端上 运行 的查询格式有点灵活。但我的问题是我无法将查询转换为 运行 在 浏览器 URL/Postman 上的 URI 格式。例如:如何将其转换为 URI 搜索格式?.

GET my_index/_search
{
  "query": {
    "geo_bounding_box": { 
      "location": {
        "top_left": {
          "lat": 42,
          "lon": -72
        },
        "bottom_right": {
          "lat": 40,
          "lon": -74
        }
      }
    }
  }
}

我在这里看到了关于 URI 搜索格式的文档,其中包含不同的 params,例如 qdf etc : https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-uri-request.html 但无法将上述查询字符串转换为 URI 搜索格式。实际上,我对支持 q、fq、sort、start、rows、boost、facet、group 等的 SOLR 查询格式非常灵活。所以,据我所知,Elastic search 也使用Lucene 索引所以我的基本问题是

1.如何将上面的ES查询字符串转换为URI搜索格式?

2. 如何轻松将 SOLR 查询转换为 ES 格式?

如果你帮我把上面的查询字符串转换成 URI Search 格式,那么将我现有的复杂 SOLR 查询转换为 ES 查询将对我有很大帮助。

N.B: 我可以使用 ?q= 转换基本的 CRUD 操作 参数,但难以隐藏其他参数,如 facet、boosting、group 等。

编辑:实际上我想说这个查询参数 returns 相同的文档编号。都来自 solr 和 es - 在这里我只对 ES 使用 _source,因为我们对 SOLR 使用 fl。否则一切都一样

https://my_host/rental_properties/_search?_source=id,code:feed_provider_id,feed_provider_id,feed,property_name,pax:occupancy,bedroom_count,min_stay,star_rating,night_rate_min,currency&q=feed:11 和 -booked_date:[2018-02-23T00:00:00Z 到 2018-02-26T00:00:00Z] 和 min_stay:[* 到 3] AND 占用率:[3 至 *] AND -latlon:0.001,0.001

Val 的回答中,我了解到 1 我可以轻松地使用相同的查询字符串进行 URI 搜索。 2。但是如何轻松地将我的 SOLR 查询转换为 ES 格式?

请注意,通过将 DSL 查询放在 source query parameter 中,始终可以使用与 URI 搜索完全相同的 DSL 查询。您还需要添加 source_content_type=application/json 参数。所以您的查询将如下所示:

GET my_index/_search?source_content_type=application/json&source={"query":{"geo_bounding_box":{"location":{"top_left":{"lat":42,"lon":-72},"bottom_right":{"lat":40,"lon":-74}}}}}