Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PUT events
- {
- "settings": {
- "analysis": {
- "filter": {
- "englishStopWords": {
- "type": "stop",
- "stopwords": "_english_"
- }
- },
- "analyzer": {
- "eventNameAnalyzer": {
- "tokenizer": "standard",
- "filter": [
- "lowercase",
- "englishStopWords"
- ]
- }
- }
- }
- },
- "mappings": {
- "event": {
- "properties": {
- "eventName": {
- "type": "keyword",
- "fields": {
- "analyzed": {
- "type": "text",
- "analyzer": "eventNameAnalyzer",
- "search_analyzer": "eventNameAnalyzer"
- }
- }
- },
- "category": {
- "type": "keyword",
- "fields": {
- "analyzed": {
- "type": "text",
- "analyzer": "eventNameAnalyzer",
- "search_analyzer": "eventNameAnalyzer"
- }
- }
- },
- "location": {
- "type": "keyword"
- },
- "price": {
- "type": "float"
- }
- }
- }
- }
- }
- GET /events
- POST events/_analyze
- {
- "text": ["Elasticsearch is a POWERFUL search engine that makes it easy for us to search"],
- "analyzer": "eventNameAnalyzer"
- }
- PUT events/event/1
- {
- "eventName": "How to process streams with Kafka Streams?",
- "category": "Software Development",
- "location": "Istanbul",
- "price": 2300
- }
- PUT events/event/2
- {
- "eventName": "Real Madrid vs Liverpool FC - UEFA Champions League 2017-18",
- "category": "Football",
- "location": "Kiev",
- "price": 3450
- }
- PUT events/event/3
- {
- "eventName": "Deep Learning Conference",
- "category": "Software Development",
- "location": "Istanbul",
- "price": 300
- }
- PUT events/event/4
- {
- "eventName": "Boston Celtics vs Philadelphia 76ers Basketball Playoff Game",
- "location": "Boston",
- "category": "Basketball",
- "price": 450
- }
- PUT events/event/5
- {
- "eventName": "Fenerbahce vs. Zalgiris Kaunas Euroleague Playoff Game",
- "category": "Basketball",
- "location": "Istanbul",
- "price": 1000
- }
- POST events/event/_search
- {
- "query": {
- "multi_match": {
- "query": "boston basketball",
- "fields": [
- "eventName.analyzed",
- "category.analyzed"
- ],
- "operator": "and",
- "type": "best_fields"
- }
- }
- }
- POST events/event/_search
- {
- "size": 0,
- "aggs": {
- "Category Filter": {
- "terms": {
- "field": "category",
- "size": 10
- }
- },
- "Location Filter": {
- "terms": {
- "field": "location",
- "size": 10
- }
- },
- "Price Filter": {
- "range": {
- "field": "price",
- "ranges": [
- {
- "from": 0,
- "to": 1000
- },
- {
- "from": 1000,
- "to": 2000
- },
- {
- "from": 2000,
- "to": 4000
- }
- ]
- }
- }
- }
- }
- POST events/event/_search
- {
- "query": {
- "multi_match": {
- "query": "game",
- "fields": [
- "eventName.analyzed",
- "category.analyzed"
- ],
- "operator": "and",
- "type": "best_fields"
- }
- },
- "aggs": {
- "Category Filter": {
- "terms": {
- "field": "category",
- "size": 10
- }
- },
- "Location Filter": {
- "terms": {
- "field": "location",
- "size": 10
- }
- },
- "Price Filter": {
- "range": {
- "field": "price",
- "ranges": [
- {
- "from": 0,
- "to": 1000
- },
- {
- "from": 1000,
- "to": 2000
- },
- {
- "from": 2000,
- "to": 3000
- }
- ]
- }
- }
- }
- }
- PUT shakespeare
- {
- "settings": {
- "analysis": {
- "filter": {
- "autocomplete_filter": {
- "type": "edge_ngram",
- "min_gram": "1",
- "max_gram": "40"
- }
- },
- "analyzer": {
- "pk_custom_analyzer": {
- "type": "custom",
- "tokenizer": "standard",
- "char_filter": [
- "html_strip"
- ],
- "filter": [
- "lowercase"
- ]
- },
- "autocomplete": {
- "filter": ["lowercase", "autocomplete_filter"],
- "type": "custom",
- "tokenizer": "whitespace"
- }
- }
- }
- },
- "mappings": {
- "event": {
- "properties": {
- "speaker": {
- "type": "keyword"
- },
- "play_name": {
- "type": "text",
- "fields": {
- "analyzed": {
- "type": "text",
- "analyzer": "pk_custom_analyzer",
- "search_analyzer": "pk_custom_analyzer"
- }
- }
- },
- "text_entry": {
- "type": "text",
- "fields": {
- "analyzed": {
- "type": "text",
- "analyzer": "autocomplete",
- "search_analyzer": "autocomplete"
- }
- }
- },
- "line_id": {
- "type": "integer"
- },
- "speech_number": {
- "type": "integer"
- },
- "line_number": {
- "type": "keyword"
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement