ip: 18.217.208.220 DKs blog - Elastic Search

DK's Blog

Elastic Search

Default Connection string for elasticSearch

http://192.168.100.7:9200/

http://192.168.100.7:9200/_plugin/head/ (head must be installed)

 


Sense addon for Chrome 

 


How to show all available idices 

 

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

How to add a record  _id: 1 for index limun, type kategorija, 

 

PUT /limun/kategorija/1
{
	"id" : "1",
	"desc" : "this is long description\r\n bla bla  vw",
	"shortDesc" : "ovo je kratki opis",
	"name" : "car",
	"active" : 1,
	"level" : "1"
}

 


How to delete

 

DELETE /limun/kargorija/1
DELETE /limun/kargorija
DELETE /limun

 


How to search all limun index

 

GET /limun/_search
{
    "query": {
        "query_string": {
            "query": "vw"
        }
    }
}

"query": "vw" - search for vw in all limun types 

"query": "vw~" - fuzzy search for vw in all limun types 


How to do a search with filter

 

GET /limun/_search
{
    "query": {
        "filtered": {
            "query": {
                "query_string": {
                    "query": "vw"
                }
            },
            "filter": {
                "term": { "active": 1}
            }
        }
    }
}

 

 

 

@2016