ElasticSearch搜索

 

最基础的搜索:

curl -XGET http://localhost:9200/_search

返回的结果为:

{
  "took": 2,
  "timed_out": false,
  "_shards": {
    "total": 16,
    "successful": 16,
    "failed": 0
  },
  "hits": {
    "total": 13,
    "max_score": 1,
    "hits": [
      {
        "_index": ".kibana",
        "_type": "config",
        "_id": "5.5.1",
        "_score": 1,
        "_source": {
          "buildNum": 15405
        }
      },
      {
        "_index": "people",
        "_type": "man",
        "_id": "8",
        "_score": 1,
        "_source": {
          "name": "deda",
          "age": 31,
          "job": "stu"
        }
      },
      {
        "_index": "people",
        "_type": "man",
        "_id": "30",
        "_score": 1,
        "_source": {
          "name": "tomi",
          "age": 19,
          "job": "master"
        }
      },
      {
        "_index": "people",
        "_type": "man",
        "_id": "5",
        "_score": 1,
        "_source": {
          "name": "ming",
          "age": 33,
          "job": "coding",
          "like": "football",
          "tel": "122334"
        }
      },
      {
        "_index": "people",
        "_type": "man",
        "_id": "2",
        "_score": 1,
        "_source": {
          "name": "fukk",
          "age": 30,
          "job": "stu"
        }
      },
      {
        "_index": "people",
        "_type": "man",
        "_id": "4",
        "_score": 1,
        "_source": {
          "name": "mask",
          "age": 40,
          "job": "CEO"
        }
      },
      {
        "_index": "people",
        "_type": "man",
        "_id": "6",
        "_score": 1,
        "_source": {
          "name": "nan",
          "age": 25,
          "job": "coding"
        }
      },
      {
        "_index": "peoples",
        "_type": "employee",
        "_id": "2",
        "_score": 1,
        "_source": {
          "first_name": "Jane",
          "last_name": "Smith",
          "age": 32,
          "about": "I like to collect rock albums",
          "interests": [
            "music"
          ]
        }
      },
      {
        "_index": "megacorp",
        "_type": "employee",
        "_id": "1",
        "_score": 1,
        "_source": {
          "first_name": "John",
          "last_name": "Smith",
          "age": 25,
          "about": "I love to go rock climbing",
          "interests": [
            "sports",
            "music"
          ]
        }
      },
      {
        "_index": "people",
        "_type": "man",
        "_id": "1",
        "_score": 1,
        "_source": {
          "name": "ahaii",
          "age": 27,
          "job": "coding"
        }
      }
    ]
  }
}
View Code

相关文章: