This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'mechanize' | |
| FILE = 'crawler.log' | |
| a = Mechanize.new { |agent| | |
| agent.user_agent_alias = 'Mac Safari' | |
| } | |
| a.get('http://www.com/') do |page| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'stretcher' | |
| # First Create a server | |
| server = Stretcher::Server.new('http://localhost:9200') | |
| # Delete an index (in case you already have this one) | |
| server.index(:foo).delete rescue nil | |
| # Create an index | |
| server.index(:foo).create(mappings: {tweet: {properties: {text: 'string'}}}) | |
| # and here I get following exception: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # setup | |
| # delete index | |
| curl -XDELETE 'http://localhost:9200/hotels/' | |
| # create index | |
| curl -XPOST 'http://localhost:9200/hotels/' | |
| # create mapping | |
| curl -XPOST localhost:9200/hotels/nested_hotel/_mapping -d '{ | |
| "nested_hotel":{ | |
| "properties":{ | |
| "rooms": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # setup | |
| # delete index | |
| curl -XDELETE 'http://localhost:9200/hotels/' | |
| # create index | |
| curl -XPOST 'http://localhost:9200/hotels/' | |
| # create mapping | |
| curl -XPOST localhost:9200/hotels/regular_hotel/_mapping -d '{ | |
| "regular_hotel":{ | |
| "properties":{ | |
| "rooms": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def search | |
| paginate_per = 30 | |
| group_id = params[:part_group] | |
| make_id = params[:make] | |
| model_id = params[:model] | |
| vehicle_category_id = params[:category] | |
| vehicle_power = params[:power] | |
| capacity = params[:capacity] | |
| q = params[:q] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def search | |
| paginate_per = 30 | |
| group_id = params[:part_group] | |
| make_id = params[:make] | |
| model_id = params[:model] | |
| vehicle_category_id = params[:category] | |
| vehicle_power = params[:power] | |
| capacity = params[:capacity] | |
| q = params[:q] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "query":{ | |
| "bool":{ | |
| "must":[ | |
| { | |
| "match_all":{ } | |
| }, | |
| { | |
| "term":{ | |
| "vehicles.vehicle_category_id":{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "query":{ | |
| "bool":{ | |
| "must":[ | |
| { | |
| "match_all":{ } | |
| }, | |
| { | |
| "term":{ | |
| "vehicles.vehicle_category_id":{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "_index" : "megastore", | |
| "_type" : "products", | |
| "_id" : "1", | |
| "_version" : 1, | |
| "exists" : true, "_source" : { | |
| "id": 1, | |
| "sKU": "SKU", | |
| "name": "monitory microsoft", | |
| "description": "producent microsoft kategoria monitory", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "products" : { | |
| "properties" : { | |
| "categoryId" : { | |
| "type" : "integer" | |
| }, | |
| "description" : { | |
| "type" : "string" | |
| }, | |
| "id" : { |
NewerOlder