Hello,World

dsl查询结果问题

Elasticsearch | 作者 401825317 | 发布于2017年06月23日 | 阅读数:2972

索引库:
{
"mall2": {
"aliases": {},
"mappings": {
"product": {
"properties": {
"brand": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"count": {
"type": "long"
},
"des": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"ispackage": {
"type": "long"
},
"isrecommend": {
"type": "long"
},
"keyword": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"label": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"level": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"mallurl": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"model": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"newprice": {
"type": "long"
},
"oldprice": {
"type": "long"
},
"parenttype": {
"type": "long"
},
"picurl": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"probrand": {
"type": "long"
},
"ptime": {
"type": "long"
},
"source": {
"type": "long"
},
"state": {
"type": "long"
},
"style": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"title": {
"type": "text",
"analyzer": "pinyin_analyzer"
},
"type": {
"type": "long"
}
}
}
},
"settings": {
"index": {
"number_of_shards": "5",
"provided_name": "mall2",
"creation_date": "1498206860941",
"analysis": {
"analyzer": {
"pinyin_analyzer": {
"type": "custom",
"tokenizer": "my_pinyin"
}
},
"tokenizer": {
"my_pinyin": {
"lowercase": "true",
"keep_original": "false",
"keep_first_letter": "true",
"keep_separate_first_letter": "true",
"type": "pinyin",
"limit_first_letter_length": "16",
"keep_full_pinyin": "true"
}
}
},
"number_of_replicas": "1",
"uuid": "ViyiX9BvRFKYW491b6NyKQ",
"version": {
"created": "5040099"
}
}
}
}
}
查询语句:
{
  "from" : 0,
  "size" : 20,
  "query" : {
    "bool" : {
      "must" : [
        {
          "match_phrase" : {
            "title" : {
              "query" : "手套",
              "slop" : 0,
              "boost" : 1.0
            }
          }
        },
        {
          "term" : {
            "state" : {
              "value" : 1,
              "boost" : 1.0
            }
          }
        }
      ],
      "disable_coord" : false,
      "adjust_pure_negative" : true,
      "boost" : 1.0
    }
  }
}
查询结果:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 38,
"max_score": 2.3667111,
"hits": [
{
"_index": "mall2",
"_type": "product",
"_id": "A94A0431C97D4B8EB75261270BA761E7",
"_score": 2.3667111,
"_source": {
"brand": "",
"count": 953,
"des": "摩托邦月兔骑士实体勋章发售中",
"id": "A94A0431C97D4B8EB75261270BA761E7",
"ispackage": 0,
"isrecommend": 0,
"keyword": "中秋节,月兔,勋章,摩托邦",
"label": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000595",
"model": "",
"newprice": 3800,
"oldprice": 6600,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 26,
"ptime": 1488740400000,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "月兔骑士实体勋章",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "B2EFBBAE8BEA41178BB12EABED056A55",
"_score": 2.3400373,
"_source": {
"brand": "",
"count": 615,
"des": "",
"id": "B2EFBBAE8BEA41178BB12EABED056A55",
"ispackage": 0,
"isrecommend": 0,
"keyword": "双鱼骑士实体勋章,双鱼,勋章",
"label": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000640",
"model": "",
"newprice": 3800,
"oldprice": 3800,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 26,
"ptime": 1488999780000,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "双鱼骑士实体勋章",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "0DF9D27990F14FEF8D18DC76A08183E6",
"_score": 2.3400373,
"_source": {
"brand": "",
"count": 140,
"des": "",
"id": "0DF9D27990F14FEF8D18DC76A08183E6",
"ispackage": 0,
"isrecommend": 0,
"keyword": "水瓶骑士,实体勋章,勋章,摩托邦",
"label": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000568",
"model": "",
"newprice": 3800,
"oldprice": 3800,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 26,
"ptime": 1488913200000,
"source": 0,
"state": 1,
"style": "",
"title": "水瓶骑士实体勋章",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "157C5753EB504BFFBC53478566D46BA9",
"_score": 2.243001,
"_source": {
"brand": "",
"count": 7502,
"des": "快来一秒亮出你的蚌壳身份!",
"id": "157C5753EB504BFFBC53478566D46BA9",
"ispackage": 0,
"isrecommend": 1,
"keyword": "车贴,反光车贴,贴纸,摩托邦贴纸",
"label": "热销,新品,限量",
"level": "A",
"mallurl": "https://mall.motoband.com/prod ... ot%3B,
"model": "",
"newprice": 11900,
"oldprice": 11900,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 26,
"ptime": 1495855200000,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "预售 摩托邦反光车贴",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "3294A390867E4048B804FC34508D3F21",
"_score": 2.2101312,
"_source": {
"count": 1240,
"des": "",
"id": "3294A390867E4048B804FC34508D3F21",
"ispackage": 0,
"isrecommend": 0,
"keyword": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000199",
"newprice": 12500,
"oldprice": 12500,
"parenttype": 6,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 51,
"ptime": 1484641960671,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "瑞士进口MOTOREX摩托瑞士摩托车表面光亮剂",
"type": 16
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "2E065E3FF128411B93D8C243CC2E100B",
"_score": 2.1844993,
"_source": {
"brand": "",
"count": 2192,
"des": "",
"id": "2E065E3FF128411B93D8C243CC2E100B",
"ispackage": 0,
"isrecommend": 0,
"keyword": "摩托邦,钥匙,钥匙扣,钥匙链,周边",
"label": "热销",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000065",
"model": "",
"newprice": 3800,
"oldprice": 3800,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 26,
"ptime": 1484648160000,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "MOTOBAND 专属钥匙链",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "9E07F8B0E3FF4BE4B30DEEBC4A623F02",
"_score": 2.1844993,
"_source": {
"brand": "",
"count": 601,
"des": "",
"id": "9E07F8B0E3FF4BE4B30DEEBC4A623F02",
"ispackage": 0,
"isrecommend": 0,
"keyword": "万圣节,幽灵骑士,实体勋章,勋章",
"label": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000312",
"model": "",
"newprice": 3800,
"oldprice": 3800,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 26,
"ptime": 1486087680000,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "幽灵骑士实体勋章",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "0DB2B80225E84FD6B93367F053F20A0E",
"_score": 2.1844993,
"_source": {
"brand": "",
"count": 3133,
"des": "",
"id": "0DB2B80225E84FD6B93367F053F20A0E",
"ispackage": 0,
"isrecommend": 0,
"keyword": "摩托邦,勋章,金牛,实体勋章,金牛座",
"label": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000726",
"model": "",
"newprice": 3800,
"oldprice": 3800,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 26,
"ptime": 1493886360000,
"source": 0,
"state": 1,
"style": "",
"title": "金牛骑士实体勋章",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "AE4A84315F344921BC982D57EA8D5B50",
"_score": 2.1552746,
"_source": {
"brand": "",
"count": 4050,
"des": "",
"id": "AE4A84315F344921BC982D57EA8D5B50",
"ispackage": 0,
"isrecommend": 1,
"keyword": "",
"label": "热销",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000225",
"model": "",
"newprice": 29900,
"oldprice": 39900,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 61,
"ptime": 1484640780000,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "摩托车骑行专用包 30升防水双肩包头层牛皮包底",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "1AE5E51E698F467EB76DA57E651E31C0",
"_score": 2.1258597,
"_source": {
"count": 1134,
"des": "",
"id": "1AE5E51E698F467EB76DA57E651E31C0",
"ispackage": 0,
"isrecommend": 0,
"keyword": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000196",
"newprice": 12900,
"oldprice": 12900,
"parenttype": 6,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 51,
"ptime": 1484642127923,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "MOTOREX摩托瑞士JOKER 440摩托车螺丝清理清洗剂",
"type": 16
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "C427BF27F4D04C5AB1BCD32469E7861A",
"_score": 2.0672445,
"_source": {
"brand": "",
"count": 4083,
"des": "",
"id": "C427BF27F4D04C5AB1BCD32469E7861A",
"ispackage": 0,
"isrecommend": 0,
"keyword": "",
"label": "新品",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000178",
"model": "",
"newprice": 1500,
"oldprice": 1500,
"parenttype": 6,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 51,
"ptime": 1484644740000,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "MOTOREX摩托瑞士VISO摩托车头盔面镜清洗套装面镜清洁擦纸",
"type": 16
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "A6829375F90542A0867B806B763BB188",
"_score": 2.0425062,
"_source": {
"brand": "",
"count": 194,
"des": "",
"id": "A6829375F90542A0867B806B763BB188",
"ispackage": 0,
"isrecommend": 0,
"keyword": "勋章",
"label": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000689",
"model": "",
"newprice": 3800,
"oldprice": 3800,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 26,
"ptime": 1489086000000,
"source": 0,
"state": 1,
"style": "",
"title": "飞龙乘云实体勋章",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "37320C48D4AF4B7F9BEC1CB76ECFBF0A",
"_score": 2.0406685,
"_source": {
"brand": "",
"count": 340,
"des": "",
"id": "37320C48D4AF4B7F9BEC1CB76ECFBF0A",
"ispackage": 0,
"isrecommend": 0,
"keyword": "摩托邦,钥匙,钥匙扣,钥匙链,周边",
"label": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000063",
"model": "",
"newprice": 2800,
"oldprice": 2800,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 26,
"ptime": 1484648580000,
"source": 0,
"state": 1,
"style": "",
"title": "MOTOBAND 长款手机链",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "B9BEB1EC413244D6B858929EBAF4373F",
"_score": 2.027806,
"_source": {
"brand": "",
"count": 72,
"des": "",
"id": "B9BEB1EC413244D6B858929EBAF4373F",
"ispackage": 0,
"isrecommend": 0,
"keyword": "周边",
"label": "热销",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000021",
"model": "",
"newprice": 6800,
"oldprice": 9900,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 26,
"ptime": 1484646900000,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "MOTOBAND X EDCO JUST RiDE 圆领短袖T恤",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "DB448F5E29C846B7B32336CAB6CC78CE",
"_score": 2.021736,
"_source": {
"brand": "",
"count": 1674,
"des": "",
"id": "DB448F5E29C846B7B32336CAB6CC78CE",
"ispackage": 0,
"isrecommend": 0,
"keyword": "新西兰,深秋北岛,境外骑行",
"label": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000718",
"model": "",
"newprice": 1699900,
"oldprice": 1699900,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 5,
"ptime": 1493277180000,
"source": 0,
"state": 1,
"style": "",
"title": "新西兰骑行 探秘深秋北岛",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "3F76442712EA4F7B9EFB731625EA101F",
"_score": 1.998859,
"_source": {
"count": 2539,
"des": "",
"id": "3F76442712EA4F7B9EFB731625EA101F",
"ispackage": 0,
"isrecommend": 1,
"keyword": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000036",
"newprice": 17900,
"oldprice": 17900,
"parenttype": 6,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 50,
"ptime": 1484645457962,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "Muc-Off摩托车清洗工具套装软毛刷3只装",
"type": 16
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "A16DADE3268A46CBB05139CC9C5F2A8A",
"_score": 1.9869231,
"_source": {
"count": 5,
"des": "摩托邦私享会:“摩范情侣”养成记",
"id": "A16DADE3268A46CBB05139CC9C5F2A8A",
"ispackage": 0,
"isrecommend": 1,
"keyword": "摩托邦私享会,私享会,报名,押金",
"label": "省心套装,限量",
"level": "A",
"mallurl": "https://mall.motoband.com/products/p000740",
"newprice": 5000,
"oldprice": 5000,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 5,
"ptime": 1498140275143,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "摩托邦私享会报名押金",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "4540BEA7D82B4BD3956E6E7366EA2623",
"_score": 1.9824322,
"_source": {
"count": 100,
"des": "",
"id": "4540BEA7D82B4BD3956E6E7366EA2623",
"ispackage": 0,
"isrecommend": 0,
"keyword": "摩托邦,白羊,勋章",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000717",
"newprice": 3800,
"oldprice": 3800,
"parenttype": 8,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 26,
"ptime": 1490927323793,
"source": 0,
"state": 1,
"title": "白羊座实体勋章",
"type": 12
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "83698C6E26104DD28D299FF84AED16BA",
"_score": 1.9664127,
"_source": {
"count": 761,
"des": "",
"id": "83698C6E26104DD28D299FF84AED16BA",
"ispackage": 0,
"isrecommend": 0,
"keyword": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000200",
"newprice": 12500,
"oldprice": 12500,
"parenttype": 6,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 51,
"ptime": 1484641854255,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "MOTOREX摩托瑞士高性能刹车清洗剂 POWER BRAKE CLEAN",
"type": 16
}
},
{
"_index": "mall2",
"_type": "product",
"_id": "D948F110CE514380A21E57D9754988FF",
"_score": 1.9593805,
"_source": {
"brand": "",
"count": 5457,
"des": "",
"id": "D948F110CE514380A21E57D9754988FF",
"ispackage": 0,
"isrecommend": 0,
"keyword": "",
"label": "",
"level": "A",
"mallurl": "http://mall.motoband.com/products/p000262",
"model": "",
"newprice": 28900,
"oldprice": 29500,
"parenttype": 6,
"picurl": "http://motobox-10013836.image. ... ot%3B,
"probrand": 50,
"ptime": 1484641740000,
"source": 0,
"state": 1,
"style": "踏板,弯梁,越野滑胎,跑车,街车,三轮,美式巡航,运动街车,其它,旅行,拉力探险,新能源,经典,大型巡航,太子",
"title": "Muc-off 5 Brush Set 清洁刷套装-5只",
"type": 16
}
}
]
}
}
想要得查询结果:
库里有几个包含手套得title,但是state都为0,我想要得是查询state为1得时候结果应该是没有才对,这又搜出来一堆state为1得其他doc。郁闷死了
已邀请:

要回复问题请先登录注册