private static Tweet GetTweet(string id, JsonNetSerializer serializer, ElasticConnection connection)
        {
            /*            
            $ curl -XGET 'http://localhost:9200/twitter/tweet/1?pretty=true'
            */

            String getCommand = Commands.Get(index: "twitter", type: "tweet", id: id).Pretty(); // this will generate: twitter/tweet/1?pretty=true

            var result = connection.Get(getCommand); 

            // Deserialize Get command result to GetResult object.
            var getResult = serializer.ToGetResult<Tweet>(result);

            var getTweet = getResult.Document;

            PrintGetCommand(getTweet, result, getCommand);

            return getTweet;
        }
Example #2
0
        private static void ListIndexAliases(ElasticConnection connection, JsonNetSerializer serializer)
        {
            /*
             * curl -XGET http://localhost:9200/twitter/_aliases
             */

            string indexAliasCommand = Commands.IndexAliases("twitter")
                .Pretty();

            var result = connection.Get(indexAliasCommand);

            // Parse index result.
            var indexAliasResult = serializer.ToIndexAliasesResult(result);

            PrintIndexAliasListResult(indexAliasResult, indexAliasCommand, result);
        }