Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching Data with Amazon CloudSearch using unique document ID of an individual hit

is it possible to Search Data with Amazon CloudSearch using unique document ID of an individual hit

example:result getting in Json Formate

stdClass Object
(
[rank] => -text_relevance
[match-expr] => (label company_name:'Greenline')
[hits] => stdClass Object        
   (
        [found] => 6
        [start] => 0
        [hit] => Array
            (
                [0] => stdClass Object                       
                (
                        [id] => ras_csv_693
                        [data] => stdClass Object

                      (
                                [all_us_sic_codes] => Array
                                    (
                                        [0] => 55719901
                                    )

                                [company_name] => Array
                                    (
                                        [0] => Greenline Equipment
                                    )

                                [contact_first_name] => Array
                                    (
                                        [0] => John
                                    )

                                [total_employees] => Array
                                    (
                                        [0] => 30
                                    )

                            )

                    )
  )

Submitting Search Requests in Amazon CloudSearch like this "http://search-movies-rr2f34ofg56xneuemujamut52i.us-east-1.cloudsearch. amazonaws.com/2011-02-01/search?bq=company_name:'Greenline'&return-fields=all_us_sic_codes,company_name,contact_first_name,total_employees" i got above example result in json format.

i want to make use of "[id] => ras_csv_693" in example,so by using this "id", searched again like this "2011-02-01/search?q=id:ras_csv_693" but i didnt get any result.. please help me to get result...

like image 350
Anu Avatar asked Nov 17 '25 14:11

Anu


2 Answers

Although you asked how to do this in version 2011-02-01, the syntax is sufficiently different in version 2013-01-01, that it's worth showing.

To search for a document by its ID in version 2013-01-01 of the CloudSearch API you use a structured query with _id:'THE_ID' as the query. For your example you would request:

.../2013-01-01/search?q.parser=structured&q=_id:'ras_csv_693'

like image 171
David Alber Avatar answered Nov 19 '25 05:11

David Alber


You can search by the document ID using: ?bq=docid:'ras_csv_693'

Example:

http://search-movies-rr2f34ofg56xneuemujamut52i.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?bq=docid:'ras_csv_693'&return-fields=all_us_sic_codes,company_name,contact_first_name,total_employees

Note that the URL must be encoded to work, here I'm not encoding just make it easy to understand.

like image 43
Everton Yoshitani Avatar answered Nov 19 '25 05:11

Everton Yoshitani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!