Common ElasticSearch queries`

Posted . Visible to the public.

Find duplicates:

curl -XGET 'localhost:9200/<your_index>/_search?pretty' -d '
{
   "aggs": {
      "dups": {
         "terms": {
            "field": "<your_field>",
            "size": 0,
            "min_doc_count": 2
         }
      }
   }
}'

Delete an index:

curl -XDELETE 'localhost:9200/<your_index>?pretty'

Count number of records in doc:

curl -XGET 'localhost:9200/<your_index>/_count?&pretty'
curl -XGET 'localhost:9200/<your_index>/_count?pretty' -H 'Content-Type: application/json' -d'
{
    "query" : {
        "term" : { "<your_field>" : "<your_value>" }
    }
}
'
hashharvest
Last edit
hashharvest
Posted by hashharvest to hashharvest's deck (2017-12-06 22:40)