小编Jes*_*sse的帖子

elasticsearch bool query必须与OR结合使用

我目前正在尝试将基于solr的应用程序迁移到elasticsearch.

我有这个lucene查询

(( 
    name:(+foo +bar) 
    OR info:(+foo +bar) 
)) AND state:(1) AND (has_image:(0) OR has_image:(1)^100)
Run Code Online (Sandbox Code Playgroud)

据我所知,这是MUST子句与布尔OR组合的组合:

"获取包含(foo AND bar in name)OR(foo AND bar in info)的所有文档.之后过滤条件状态= 1,并提升具有图像的文档."

我一直试图使用一个bool查询,但我没有得到boolean OR到must子句.这是我有的:

GET /test/object/_search
{
  "from": 0,
  "size": 20,
  "sort": {
    "_score": "desc"
  },
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "name": "foo"
          }
        },
        {
          "match": {
            "name": "bar"
          }
        }
      ],
      "must_not": [],
      "should": [
        {
          "match": {
            "has_image": {
              "query": 1,
              "boost": 100
            }
          }
        }
      ]
    }
  } …
Run Code Online (Sandbox Code Playgroud)

elasticsearch

147
推荐指数
5
解决办法
11万
查看次数

谷歌通用分析事件已发送但未被分析收到

我在我的网站上使用谷歌通用分析.虽然POST请求似乎正确发送,但我的分析帐户中没有跟踪事件.

这是帖子请求(网址和分析ID被屏蔽)

Request URL:http://www.google-analytics.com/collect
Request Method:POST
Status Code:200 OK
Request Headersview source
Accept:application/json, text/javascript, */*; q=0.01
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Content-Length:120
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
Host:www.google-analytics.com
Origin:http://www.xxxxxxxx.com
Referer:http://www.xxxxxxxx.com/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31
Form Dataview sourceview URL encoded
v:1
tid:UA-xxxxxxxxx-1
cid:3E1FA9FE-28B3-7032-1714-5083DD155FCF
t:click
ec:link
ea:outbound_link
el:startpage
ev:headline
Response Headersview source
Access-Control-Allow-Origin:*
Cache-Control:private, no-cache, no-cache=Set-Cookie, proxy-revalidate
Connection:keep-alive
Content-Length:35
Content-Type:image/gif
Date:Fri, 10 May 2013 13:25:44 GMT
Expires:Mon, 07 Aug 1995 23:30:00 GMT
Last-Modified:Sun, 17 May 1998 03:00:00 …
Run Code Online (Sandbox Code Playgroud)

google-analytics

6
推荐指数
1
解决办法
4057
查看次数

标签 统计

elasticsearch ×1

google-analytics ×1