ES权威指南[官方文档学习笔记]-12 more complicated searches

es:http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_more_complicated_searches.html

下一篇:http://my.oschina.net/qiangzigege/blog/263747

内容:

来一点更复杂的例子.
添加了一个限制,年纪大于30,

GET /megacorp/employee/_search
{
    "query" : {
        "filtered" : {
            "filter" : {
                "range" : {
                    "age" : { "gt" : 30 } 
                }
            },
            "query" : {
                "match" : {
                    "last_name" : "smith" 
                }
            }
        }
    }
}


不用担心语法, 后面会讲更多细节.
搜索结果如下:

{
   ...
   "hits": {
      "total":      1,
      "max_score":  0.30685282,
      "hits": [
         {
            ...
            "_source": {
               "first_name":  "Jane",
               "last_name":   "Smith",
               "age":         32,
               "about":       "I like to collect rock albums",
               "interests": [ "music" ]
            }
         }
      ]
   }
}

 

 

你可能感兴趣的:(elasticsearch)