<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>8.2. Output — groonga v3.0.5 documentation</title> <link rel="stylesheet" href="../_static/groonga.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '3.0.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="shortcut icon" href="../_static/favicon.ico"/> <link rel="top" title="groonga v3.0.5 documentation" href="../index.html" /> <link rel="up" title="8. リファレンスマニュアル" href="../reference.html" /> <link rel="next" title="8.3. Command" href="command.html" /> <link rel="prev" title="8.1.6. groonga-suggest-create-dataset" href="executables/groonga-suggest-create-dataset.html" /> </head> <body> <div class="header"> <h1 class="title"> <a id="top-link" href="../index.html"> <span class="project">groonga</span> <span class="separator">-</span> <span class="description">An open-source fulltext search engine and column store.</span> </a> </h1> <div class="other-language-links"> <ul> <li><a href="../../../ja/html/reference/output.html"><img src="../_static/jp.png" alt="日本語">日本語版はこちら</a></li> </ul> </div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="command.html" title="8.3. Command" accesskey="N">next</a> |</li> <li class="right" > <a href="executables/groonga-suggest-create-dataset.html" title="8.1.6. groonga-suggest-create-dataset" accesskey="P">previous</a> |</li> <li><a href="../index.html">groonga v3.0.5 documentation</a> »</li> <li><a href="../reference.html" accesskey="U">8. リファレンスマニュアル</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="output"> <h1>8.2. Output<a class="headerlink" href="#output" title="Permalink to this headline">¶</a></h1> <p>Groonga supports the following output format types:</p> <blockquote> <div><ul class="simple"> <li><a class="reference external" href="http://www.json.org/">JSON</a></li> <li><a class="reference external" href="http://www.w3.org/XML/">XML</a></li> <li>TSV (Tab Separated Values)</li> <li><a class="reference external" href="http://msgpack.org/">MessagePack</a></li> </ul> </div></blockquote> <p>JSON is the default output format.</p> <div class="section" id="usage"> <h2>8.2.1. Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2> <p>Groonga has the following query interfaces:</p> <blockquote> <div><ul class="simple"> <li>command line</li> <li>HTTP</li> </ul> </div></blockquote> <p>They provides different ways to change output format type.</p> <div class="section" id="command-line"> <h3>8.2.1.1. Command line<a class="headerlink" href="#command-line" title="Permalink to this headline">¶</a></h3> <p>You can use command line query interface by <tt class="docutils literal"><span class="pre">groonga</span> <span class="pre">DB_PATH</span></tt> or <tt class="docutils literal"><span class="pre">groonga</span> <span class="pre">-c</span></tt>. Those groonga commands shows <tt class="docutils literal"><span class="pre">></span> <span class="pre">``</span> <span class="pre">prompt.</span> <span class="pre">In</span> <span class="pre">this</span> <span class="pre">query</span> <span class="pre">interface,</span> <span class="pre">you</span> <span class="pre">can</span> <span class="pre">specify</span> <span class="pre">output</span> <span class="pre">format</span> <span class="pre">type</span> <span class="pre">by</span> <span class="pre">``output_type</span></tt> option.</p> <p>If you don't specify <tt class="docutils literal"><span class="pre">output_type</span></tt> option, you will get a result in JSON format:</p> <div class="highlight-none"><div class="highlight"><pre>> status [[0,1327721628.10738,0.000131845474243164],{"alloc_count":142,"starttime":1327721626,"uptime":2,"version":"1.2.9-92-gb87d9f8","n_queries":0,"cache_hit_rate":0.0,"command_version":1,"default_command_version":1,"max_command_version":2}] </pre></div> </div> <p>You can specify <tt class="docutils literal"><span class="pre">json</span></tt> as <tt class="docutils literal"><span class="pre">output_type</span></tt> value to get a result in JSON format explicitly:</p> <div class="highlight-none"><div class="highlight"><pre>> status --output_type json [[0,1327721639.08321,7.93933868408203e-05],{"alloc_count":144,"starttime":1327721626,"uptime":13,"version":"1.2.9-92-gb87d9f8","n_queries":0,"cache_hit_rate":0.0,"command_version":1,"default_command_version":1,"max_command_version":2}] </pre></div> </div> <p>You need to specify <tt class="docutils literal"><span class="pre">xml</span></tt> as <tt class="docutils literal"><span class="pre">output_type</span></tt> value to get a result in XML format:</p> <div class="highlight-none"><div class="highlight"><pre>> status --output_type xml <?xml version="1.0" encoding="utf-8"?> <RESULT CODE="0" UP="1327721649.61095" ELAPSED="0.000126361846923828"> <RESULT> <TEXT>alloc_count</TEXT> <INT>146</INT> <TEXT>starttime</TEXT> <INT>1327721626</INT> <TEXT>uptime</TEXT> <INT>23</INT> <TEXT>version</TEXT> <TEXT>1.2.9-92-gb87d9f8</TEXT> <TEXT>n_queries</TEXT> <INT>0</INT> <TEXT>cache_hit_rate</TEXT> <FLOAT>0.0</FLOAT> <TEXT>command_version</TEXT> <INT>1</INT> <TEXT>default_command_version</TEXT> <INT>1</INT> <TEXT>max_command_version</TEXT> <INT>2</INT></RESULT> </RESULT> </pre></div> </div> <p>You need to specify <tt class="docutils literal"><span class="pre">tsv</span></tt> as <tt class="docutils literal"><span class="pre">output_type</span></tt> value to get a result in TSV format:</p> <div class="highlight-none"><div class="highlight"><pre>> status --output_type tsv 0 1327721664.82675 0.000113964080810547 "alloc_count" 146 "starttime" 1327721626 "uptime" 38 "version" "1.2.9-92-gb87d9f8" "n_queries" 0 "cache_hit_rate" 0.0 "command_version" 1 "default_command_version" 1 "max_command_version" 2 END </pre></div> </div> <p>You need to specify <tt class="docutils literal"><span class="pre">msgpack</span></tt> as <tt class="docutils literal"><span class="pre">output_type</span></tt> value to get a result in MessagePack format:</p> <div class="highlight-none"><div class="highlight"><pre>> status --output_type msgpack (... omitted because MessagePack is binary data format. ...) </pre></div> </div> </div> <div class="section" id="http"> <h3>8.2.1.2. HTTP<a class="headerlink" href="#http" title="Permalink to this headline">¶</a></h3> <p>You can use HTTP query interface by <tt class="docutils literal"><span class="pre">groonga</span> <span class="pre">--protocol</span> <span class="pre">http</span> <span class="pre">-s</span> <span class="pre">DB_PATH</span></tt>. Groonga HTTP server starts on port 10041 by default. In this query interface, you can specify output format type by extension.</p> <p>If you don't specify extension, you will get a result in JSON format:</p> <div class="highlight-none"><div class="highlight"><pre>% curl http://localhost:10041/d/status [[0,1327809294.54311,0.00082087516784668],{"alloc_count":155,"starttime":1327809282,"uptime":12,"version":"1.2.9-92-gb87d9f8","n_queries":0,"cache_hit_rate":0.0,"command_version":1,"default_command_version":1,"max_command_version":2}] </pre></div> </div> <p>You can specify <tt class="docutils literal"><span class="pre">json</span></tt> as extension to get a result in JSON format explicitly:</p> <div class="highlight-none"><div class="highlight"><pre>% curl http://localhost:10041/d/status.json [[0,1327809319.01929,9.5367431640625e-05],{"alloc_count":157,"starttime":1327809282,"uptime":37,"version":"1.2.9-92-gb87d9f8","n_queries":0,"cache_hit_rate":0.0,"command_version":1,"default_command_version":1,"max_command_version":2}] </pre></div> </div> <p>You need to specify <tt class="docutils literal"><span class="pre">xml</span></tt> as extension to get a result in XML format:</p> <div class="highlight-none"><div class="highlight"><pre>% curl http://localhost:10041/d/status.xml <?xml version="1.0" encoding="utf-8"?> <RESULT CODE="0" UP="1327809339.5782" ELAPSED="9.56058502197266e-05"> <RESULT> <TEXT>alloc_count</TEXT> <INT>159</INT> <TEXT>starttime</TEXT> <INT>1327809282</INT> <TEXT>uptime</TEXT> <INT>57</INT> <TEXT>version</TEXT> <TEXT>1.2.9-92-gb87d9f8</TEXT> <TEXT>n_queries</TEXT> <INT>0</INT> <TEXT>cache_hit_rate</TEXT> <FLOAT>0.0</FLOAT> <TEXT>command_version</TEXT> <INT>1</INT> <TEXT>default_command_version</TEXT> <INT>1</INT> <TEXT>max_command_version</TEXT> <INT>2</INT></RESULT> </RESULT> </pre></div> </div> <p>You need to specify <tt class="docutils literal"><span class="pre">tsv</span></tt> as extension to get a result in TSV format:</p> <div class="highlight-none"><div class="highlight"><pre>% curl http://localhost:10041/d/status.tsv 0 1327809366.84187 8.44001770019531e-05 "alloc_count" 159 "starttime" 1327809282 "uptime" 84 "version" "1.2.9-92-gb87d9f8" "n_queries" 0 "cache_hit_rate" 0.0 "command_version" 1 "default_command_version" 1 "max_command_version" 2 END </pre></div> </div> <p>You need to specify <tt class="docutils literal"><span class="pre">msgpack</span></tt> as extension to get a result in MessagePack format:</p> <div class="highlight-none"><div class="highlight"><pre>% curl http://localhost:10041/d/status.msgpack (... omitted because MessagePack is binary data format. ...) </pre></div> </div> </div> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">8.2. Output</a><ul> <li><a class="reference internal" href="#usage">8.2.1. Usage</a><ul> <li><a class="reference internal" href="#command-line">8.2.1.1. Command line</a></li> <li><a class="reference internal" href="#http">8.2.1.2. HTTP</a></li> </ul> </li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="executables/groonga-suggest-create-dataset.html" title="previous chapter">8.1.6. groonga-suggest-create-dataset</a></p> <h4>Next topic</h4> <p class="topless"><a href="command.html" title="next chapter">8.3. Command</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/reference/output.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="command.html" title="8.3. Command" >next</a> |</li> <li class="right" > <a href="executables/groonga-suggest-create-dataset.html" title="8.1.6. groonga-suggest-create-dataset" >previous</a> |</li> <li><a href="../index.html">groonga v3.0.5 documentation</a> »</li> <li><a href="../reference.html" >8. リファレンスマニュアル</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009-2013, Brazil, Inc. </div> </body> </html>