File: search.php

package info (click to toggle)
php-horde-elasticsearch 1.0.4-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 108 kB
  • sloc: xml: 197; php: 162; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 569 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Basic example for searching with ElasticSearch
 *
 * Copyright 2011-2017 Horde LLC (http://www.horde.org/)
 *
 * @author   Chuck Hagenbuch <chuck@horde.org>
 * @license  http://www.horde.org/licenses/bsd BSD
 * @category Horde
 * @package  ElasticSearch
 */

require 'Horde/Autoloader/Default.php';

$client = new Horde_ElasticSearch_Client('http://localhost:9200/', new Horde_Http_Client());
$twitter = new Horde_ElasticSearch_Index('twitter', $client);
$tweet = new Horde_ElasticSearch_Type('tweet', $twitter);
var_dump($tweet->search('elasticsearch'));