Kibana query samples

Base url: http://localhost:9200

List all

GET _search
{
  "query": {
    "match_all": {}
  }
}

 

List all indexes

get _cat/indices

Delete indice “andro_sensor_rrr
DELETE andro_sensor_rrr

 

Search for keyword
List all documents

GET twitter_new/_search

List all documents and display only text attribute containing query string

GET twitter_new/_search
{
  "query": {
    "query_string": {
      "default_field": "text",
      "query": "api"
    }
  }
}
GET twitter_new/_search
{
  "_source": {
    "includes": [
      "text"
    ]
  }
}

 

Add mapping

PUT andro_sensor
{
  "mappings": {
    "my_type": {
      "_timestamp": {
        "enabled": true
      }
    }
  }
}

Complex search show only attributes listed in includes, order by created_at field and _score value in descending order.

GET twitter_new/_search?q=IoT
{
  "_source": {
    "includes": [
      "text",
      "created_at",
      "entities.urls.url"
    ]
  },
  "sort": [
    {
      "created_at": {
        "order": "desc"
      }
    },
    {
      "_score": {
        "order": "desc"
      }
    }
  ]
}

Comples search as cURL

POST /twitter_new/_search?q=kaczor AND PIS HTTP/1.1
Host: localhost:9200
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 65b9524f-4412-1d6d-7a1b-cff6971b7c84

{
  "_source": {
    "includes": [
      "text",
      "created_at",
      "entities.urls.url"
    ]
  },
  "sort": [
    {
      "created_at": {
        "order": "desc"
      }
    },
    {
      "_score": {
        "order": "desc"
      }
    }
  ]
}

 

One thought on “Kibana query samples”

  1. I have noticed you don’t monetize 134.135, don’t waste your traffic, you can earn extra
    bucks every month with new monetization method.

    This is the best adsense alternative for any type of website (they approve all websites), for more
    info simply search in gooogle: murgrabia’s tools

Leave a Reply

Your email address will not be published. Required fields are marked *