JSONP and Facet queries


#1

Does anyone have an example of what the uri/querystring looks like for
a facet query?

Trying to do a JSONP query with facets. Cant find anything in the
documentation though.
Any pointers?

Cheers,
Nick


(Shay Banon) #2

jsonp and facets are two different things. jsonp applies to any HTTP REST
API, simply add a callback with your name of the function as a parameter,
and the response will be wrapped in jsonp.

Regarding facets, they are part of the search request (like query, from, to,
sort, ...), and documented here:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/facets/.

-shay.banon

On Thu, Oct 7, 2010 at 6:12 PM, the claw nick.minutello@gmail.com wrote:

Does anyone have an example of what the uri/querystring looks like for
a facet query?

Trying to do a JSONP query with facets. Cant find anything in the
documentation though.
Any pointers?

Cheers,
Nick


#3

Maybe Im misunderstanding something....
The only examples I see for facet queries involved sending a json
body. Can you send body data with jsonp??

I was looking for some mention of support for facets here:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/uri_request/

-Nick

On Oct 7, 5:55 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

jsonp and facets are two different things. jsonp applies to any HTTP REST
API, simply add a callback with your name of the function as a parameter,
and the response will be wrapped in jsonp.

Regarding facets, they are part of the search request (like query, from, to,
sort, ...), and documented here:http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/facets/.

-shay.banon

On Thu, Oct 7, 2010 at 6:12 PM, the claw nick.minute...@gmail.com wrote:

Does anyone have an example of what the uri/querystring looks like for
a facet query?

Trying to do a JSONP query with facets. Cant find anything in the
documentation though.
Any pointers?

Cheers,
Nick


(Shay Banon) #4

In terms of pure HTTP, you can use JSONP with GET and POST. Regarding actual
implementations of it, I know that GET on some implementations does not
accept a body, thats why the search endpoint also supports POST (yuck!).

You can't define facets in the URI based request (its senseless to try and
expose all the facets options there), so you can use facets when searching
with a search request body.

-shay.banon

On Thu, Oct 7, 2010 at 7:53 PM, Mooky nick.minutello@gmail.com wrote:

Maybe Im misunderstanding something....
The only examples I see for facet queries involved sending a json
body. Can you send body data with jsonp??

I was looking for some mention of support for facets here:

http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/uri_request/

-Nick

On Oct 7, 5:55 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

jsonp and facets are two different things. jsonp applies to any HTTP REST
API, simply add a callback with your name of the function as a parameter,
and the response will be wrapped in jsonp.

Regarding facets, they are part of the search request (like query, from,
to,
sort, ...), and documented here:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/facets/.

-shay.banon

On Thu, Oct 7, 2010 at 6:12 PM, the claw nick.minute...@gmail.com
wrote:

Does anyone have an example of what the uri/querystring looks like for
a facet query?

Trying to do a JSONP query with facets. Cant find anything in the
documentation though.
Any pointers?

Cheers,
Nick


(Shay Banon) #5

Note also that elasticsearch HTTP endpoint
supports Access-Control-Allow-Origin (
https://developer.mozilla.org/en/HTTP_access_control), so you might not even
need jsonp.

-shay.banon

On Thu, Oct 7, 2010 at 8:12 PM, Shay Banon shay.banon@elasticsearch.comwrote:

In terms of pure HTTP, you can use JSONP with GET and POST. Regarding
actual implementations of it, I know that GET on some implementations does
not accept a body, thats why the search endpoint also supports POST
(yuck!).

You can't define facets in the URI based request (its senseless to try and
expose all the facets options there), so you can use facets when searching
with a search request body.

-shay.banon

On Thu, Oct 7, 2010 at 7:53 PM, Mooky nick.minutello@gmail.com wrote:

Maybe Im misunderstanding something....
The only examples I see for facet queries involved sending a json
body. Can you send body data with jsonp??

I was looking for some mention of support for facets here:

http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/uri_request/

-Nick

On Oct 7, 5:55 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

jsonp and facets are two different things. jsonp applies to any HTTP
REST
API, simply add a callback with your name of the function as a
parameter,
and the response will be wrapped in jsonp.

Regarding facets, they are part of the search request (like query, from,
to,
sort, ...), and documented here:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/facets/.

-shay.banon

On Thu, Oct 7, 2010 at 6:12 PM, the claw nick.minute...@gmail.com
wrote:

Does anyone have an example of what the uri/querystring looks like for
a facet query?

Trying to do a JSONP query with facets. Cant find anything in the
documentation though.
Any pointers?

Cheers,
Nick


#6

As far as I understand it, with jsonp, you can only do a uri get ...
ie whatever you can encode into the uri ... (no post, no
body)

On Oct 7, 7:12 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

In terms of pure HTTP, you can use JSONP with GET and POST. Regarding actual
implementations of it, I know that GET on some implementations does not
accept a body, thats why the search endpoint also supports POST (yuck!).

You can't define facets in the URI based request (its senseless to try and
expose all the facets options there), so you can use facets when searching
with a search request body.

-shay.banon

On Thu, Oct 7, 2010 at 7:53 PM, Mooky nick.minute...@gmail.com wrote:

Maybe Im misunderstanding something....
The only examples I see for facet queries involved sending a json
body. Can you send body data with jsonp??

I was looking for some mention of support for facets here:

http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/uri_r...

-Nick

On Oct 7, 5:55 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

jsonp and facets are two different things. jsonp applies to any HTTP REST
API, simply add a callback with your name of the function as a parameter,
and the response will be wrapped in jsonp.

Regarding facets, they are part of the search request (like query, from,
to,
sort, ...), and documented here:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/facets/.

-shay.banon

On Thu, Oct 7, 2010 at 6:12 PM, the claw nick.minute...@gmail.com
wrote:

Does anyone have an example of what the uri/querystring looks like for
a facet query?

Trying to do a JSONP query with facets. Cant find anything in the
documentation though.
Any pointers?

Cheers,
Nick


#7

super-cool

On Oct 7, 7:14 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Note also that elasticsearch HTTP endpoint
supports Access-Control-Allow-Origin (https://developer.mozilla.org/en/HTTP_access_control), so you might not even
need jsonp.

-shay.banon

On Thu, Oct 7, 2010 at 8:12 PM, Shay Banon shay.ba...@elasticsearch.comwrote:

In terms of pure HTTP, you can use JSONP with GET and POST. Regarding
actual implementations of it, I know that GET on some implementations does
not accept a body, thats why the search endpoint also supports POST
(yuck!).

You can't define facets in the URI based request (its senseless to try and
expose all the facets options there), so you can use facets when searching
with a search request body.

-shay.banon

On Thu, Oct 7, 2010 at 7:53 PM, Mooky nick.minute...@gmail.com wrote:

Maybe Im misunderstanding something....
The only examples I see for facet queries involved sending a json
body. Can you send body data with jsonp??

I was looking for some mention of support for facets here:

http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/uri_r...

-Nick

On Oct 7, 5:55 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

jsonp and facets are two different things. jsonp applies to any HTTP
REST
API, simply add a callback with your name of the function as a
parameter,
and the response will be wrapped in jsonp.

Regarding facets, they are part of the search request (like query, from,
to,
sort, ...), and documented here:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/facets/.

-shay.banon

On Thu, Oct 7, 2010 at 6:12 PM, the claw nick.minute...@gmail.com
wrote:

Does anyone have an example of what the uri/querystring looks like for
a facet query?

Trying to do a JSONP query with facets. Cant find anything in the
documentation though.
Any pointers?

Cheers,
Nick


(Shay Banon) #8

Ahh, wrote something wrong. I meant a body with GET request, which not all
support, not jsonp. The search Rest API (GET) supports passing the whole
"body" as a "source" parameter. Hackish, better check the access control
option first.

-shay.banon

On Thu, Oct 7, 2010 at 8:38 PM, Mooky nick.minutello@gmail.com wrote:

As far as I understand it, with jsonp, you can only do a uri get ...
ie whatever you can encode into the uri ... (no post, no
body)

On Oct 7, 7:12 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

In terms of pure HTTP, you can use JSONP with GET and POST. Regarding
actual
implementations of it, I know that GET on some implementations does not
accept a body, thats why the search endpoint also supports POST (yuck!).

You can't define facets in the URI based request (its senseless to try
and
expose all the facets options there), so you can use facets when
searching
with a search request body.

-shay.banon

On Thu, Oct 7, 2010 at 7:53 PM, Mooky nick.minute...@gmail.com wrote:

Maybe Im misunderstanding something....
The only examples I see for facet queries involved sending a json
body. Can you send body data with jsonp??

I was looking for some mention of support for facets here:

http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/uri_r.
..

-Nick

On Oct 7, 5:55 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

jsonp and facets are two different things. jsonp applies to any HTTP
REST

API, simply add a callback with your name of the function as a
parameter,

and the response will be wrapped in jsonp.

Regarding facets, they are part of the search request (like query,
from,

to,

sort, ...), and documented here:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/facets/
.

-shay.banon

On Thu, Oct 7, 2010 at 6:12 PM, the claw nick.minute...@gmail.com
wrote:

Does anyone have an example of what the uri/querystring looks like
for

a facet query?

Trying to do a JSONP query with facets. Cant find anything in the
documentation though.
Any pointers?

Cheers,
Nick


(system) #9