简体   繁体   中英

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...

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'

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM