It is time
to communicate with elastic search. This post is foundation for all subsequent
posts. We can communicate with Elastic search using Java APIs (or) Elastic
search Restful API. I will explain about Java API later. For learning purpose,
I am going to use Sense.
Open Sense
console by hitting following URL.
Update Server
as “localhost:9200”.
In left side
of window type “GET _count” and hit Run button.
You will get
following output in right frame of sense window.
{
"count": 789,
"_shards": {
"total": 2,
"successful": 2,
"failed": 0
}
}
Above
request can be mapped to localhost:9200/_count.
From now on
wards, I am going to use following notation to query elastic search.
curl -XGET
'http://localhost:9200/_count
If request
has any body in it, it is added to bottom of the url like below.
curl -XGET
'http://localhost:9200/_count ?pretty'
{
"query": {
"match_all": {}
}
}
In the rest
of the tutorial, I am going to use following format, which is like Sense
format.
GET _count
?pretty'
{
"query": {
"match_all": {}
}
}
No comments:
Post a Comment