弹性搜索始终不返回任何结果

时间:2017-10-07 01:42:49

标签: amazon-web-services elasticsearch amazon-elasticsearch

我正在尝试使用以下指令测试弹性搜索:

http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-gsg.html

当我尝试上述内容并上传以下文本时,该文本也在说明中:

{
   "index": {
    "_index": "movies",
    "_type": "listings",
    "_id": "2"
}
 } {
"director": "Frankenheimer, John",
"genre": ["Drama", "Mystery", "Thriller"],
"year": 1962,
"actor": ["Lansbury, Angela", "Sinatra, Frank", "Leigh, Janet", "Harvey, Laurence", "Silva, Henry", "Frees, Paul", "Gregory, James", "Bissell, Whit", "McGiver, John", "Parrish, Leslie", "Edwards, James", "Flowers, Bess", "Dhiegh, Khigh", "Payne, Julie", "Kleeb, Helen", "Gray, Joe", "Nalder, Reggie", "Stevens, Bert", "Masters, Michael", "Lowell, Tom"],
"title": "The Manchurian Candidate"
 } {
"index": {
    "_index": "movies",
    "_type": "listings",
    "_id": "3"
}
} {
"director": "Baird, Stuart",
"genre": ["Action", "Crime", "Thriller"],
"year": 1998,
"actor": ["Downey Jr., Robert", "Jones, Tommy Lee", "Snipes, Wesley", "Pantoliano, Joe", "Jacob, Ir\u00e8ne", "Nelligan, Kate", "Roebuck, Daniel", "Malahide, Patrick", "Richardson, LaTanya", "Wood, Tom", "Kosik, Thomas", "Stellate, Nick", "Minkoff, Robert", "Brown, Spitfire", "Foster, Reese", "Spielbauer, Bruce", "Mukherji, Kevin", "Cray, Ed", "Fordham, David", "Jett, Charlie"],
"title": "U.S. Marshals"
} {
"index": {
    "_index": "movies",
    "_type": "listings",
    "_id": "4"
}
} {
"director": "Ray, Nicholas",
"genre": ["Drama", "Romance"],
"year": 1955,
"actor": ["Hopper, Dennis", "Wood, Natalie", "Dean, James", "Mineo, Sal", "Backus, Jim", "Platt, Edward", "Ray, Nicholas", "Hopper, William", "Allen, Corey", "Birch, Paul", "Hudson, Rochelle", "Doran, Ann", "Hicks, Chuck", "Leigh, Nelson", "Williams, Robert", "Wessel, Dick", "Bryar, Paul", "Sessions, Almira", "McMahon, David", "Peters Jr., House"],
"title": "Rebel Without a Cause"
 }

我使用此命令后:

curl -XGET 'search-movies-4f3nw7eiia2xiynjr55a2nao2y.us-west-1.es.amazonaws.com/movies/_search?q=Frankenheimer'

我再也没有得到任何回报。总是返回0.以下是我的回复:

enter image description here

我不是,如果我做得对,但我认为我应该能够看到至少一些东西,因为我在上传的json数据的导演键中有Frankenheimer。有人能说清楚吗?

1 个答案:

答案 0 :(得分:1)

尝试使用File.ReadAllBytes(Photo);搜索整个索引,默认情况下会返回前10个结果。如果返回小于10,则数据可能不在索引中。

您可以通过将查询更改为:

来验证
    if(i%5==4){ //DATE
        std::string date;
        int day;
        int month;
        int year;
        std::ostringstream oss(date);
        oss << day;
        oss << month;
        oss << year;
        const int lookup_table[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
        if (!(month >= 1 && month <= 12)){
            return false;}
        if (!(day >= 1 && day <= lookup_table[month-1])){
            return false;}
        if (!(year >= 1900)){
            return false;}
        return true;
    }

查看Elasticsearch URI Search以获取完整的参数列表。