Giter Site home page Giter Site logo

humanmade / icspresso Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tcrsavage/icspresso

3.0 11.0 0.0 97 KB

WordPress elasticsearch integration

License: GNU General Public License v2.0

JavaScript 4.82% CSS 1.87% PHP 93.32%
elasticsearch wordpress

icspresso's Introduction

Icspresso

WordPress elasticsearch integration

This plugin adds automatic indexing capabilities and elastic search client wrapping to your wordpress site. The plugin is designed for developers who whish to conduct heavily customised elasticsearch queries on their WordPress data

  • Automaitcally indexes and syncs posts, users, comments and terms along with applicable meta into your elasticsearch server
  • Adds convenient wrappers to your document types with low level search API
  • Logs bad requests and errors into a dedicated database stored log

###Requirements

  • PHP >= 5.3
  • WordPress >= 3.8 (probably works on older versions too)
  • Functioning WordPress Cron (some hosts do not support WordPress cron)
  • An elasticsearch server

###Setup

  1. Set up your elasticsearch server (https://gist.github.com/wingdspur/2026107)
  2. Download and install the plugin in your plugins/mu-plugins directory, then activate
  3. Navigate to the main Icspresso Elasticsearch settings page in wp-admin and add your elasticsearch server's address+port+protocol
  4. Check that 'Status' reads 'OK' after submitting your settings. If not, check your settings and try again
  5. Navigate to the 'indexing' screen and reindex all your document types to apply an initial sync to your existing data
  6. Navigate to the logs page and check for any errors, then check your php error logs to ensure there are no issues with your setup

###Running queries

$type = \Icspresso\Master::get_type( 'post' );

//Get published posts which were authored by author ID=1 queried by post_title, post_content contains 'My', 'test', 'post'

$r = $type->search( array(
	"query" => array(
		'bool' => array(
			'must' => array(
				array(
					'term' => array(
						'post_type' => 'post',
					),
				),
				array(
					'term' => array(
						'post_status' => 'publish',
					),
				),
				array(
					'term' => array(
						'post_author' => '1'
					)
				),
				array(
					'multi_match' => array(
						'query'  => 'My test post',
						'fields' => array( 'post_title^5', 'post_content' )
					)
				),
			)
		)
	)
) );

icspresso's People

Contributors

bathan avatar roborourke avatar tcrsavage avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

icspresso's Issues

is_connection_available generates a bad request

screen shot 2017-12-12 at 14 01 27

Here in the code is the statement that causes the issue: https://github.com/humanmade/icspresso/blob/master/classes/api.php#L84
Actually, it probably happens wherever the request method is used

I think the problem is that buildUrl https://github.com/nervetattoo/elasticsearch/blob/9e1bc3548dd10f96ab86a03f5ea5ad0b014bc287/src/ElasticSearch/Transport/Base.php#L127 adds an extra leading slash, which elastic search doesn't mind, if you use curl you get a valid response, but the WP_Http_Request library doesn't.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.