简体   繁体   English

使用单个匹配的唯一文档ID通过Amazon CloudSearch搜索数据

[英]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 是否可以使用单个匹配的唯一文档ID通过Amazon CloudSearch搜索数据

example:result getting in Json Formate 示例:获取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. 在Amazon CloudSearch中提交搜索请求,例如“ 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“我上面的示例结果以json格式显示。

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... 我想在示例中使用“ [id] => ras_csv_693”,因此通过使用此“ id”,再次搜索为“ 2011-02-01 / search?q = id:ras_csv_693”,但我没有得到任何结果..请帮助我获得结果...

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. 尽管您在版本2011-02-01中询问了如何执行此操作,但语法在版本2013-01-01中已足够不同,值得一看。

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. 要在CloudSearch API的版本2013-01-01中按ID来搜索文档,请使用结构化查询, _id:'THE_ID'查询_id:'THE_ID'用作查询。 For your example you would request: 对于您的示例,您将要求:

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

You can search by the document ID using: ?bq=docid:'ras_csv_693' 您可以使用以下文档按文档ID搜索: ?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. 请注意,必须对URL进行编码才能正常工作,这里我并不是对URL进行编码,只是为了使其易于理解。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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