Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - curl -XPUT 'http://localhost:9200/test_attribs?pretty' -d '{
 - "settings": {
 - "analysis": {
 - "analyzer": {
 - "ngram_analyzer": {
 - "filter": [
 - "lowercase",
 - "asciifolding",
 - "ngram_filter"
 - ],
 - "tokenizer": "whitespace",
 - "type": "custom"
 - },
 - "searchterm_analyzer": {
 - "filter": [
 - "lowercase",
 - "asciifolding"
 - ],
 - "tokenizer": "whitespace",
 - "type": "custom"
 - }
 - },
 - "filter": {
 - "ngram_filter": {
 - "max_gram": 30,
 - "min_gram": 3,
 - "token_chars": [
 - "letter",
 - "digit",
 - "punctuation",
 - "symbol"
 - ],
 - "type": "edgeNGram"
 - }
 - }
 - },
 - "number_of_replicas": 0,
 - "number_of_shards": 5
 - }
 - }'
 - curl -XPUT 'http://localhost:9200/test_attribs/_mapping/prodgroup_with_attribs?pretty' -d '{
 - "prodgroup_with_attribs": {
 - "dynamic": "strict",
 - "properties": {
 - "attributes": {
 - "properties": {
 - "key": {
 - "index": "not_analyzed",
 - "type": "string"
 - },
 - "value": {
 - "index": "not_analyzed",
 - "type": "string"
 - }
 - },
 - "type": "nested"
 - },
 - "prodno": {
 - "index_analyzer": "ngram_analyzer",
 - "search_analyzer": "searchterm_analyzer",
 - "type": "string"
 - }
 - }
 - }
 - }'
 - curl -XPUT 'http://localhost:9200/test_attribs/prodgroup_with_attribs/WEBC2590?pretty' -d '{
 - "attributes": [
 - {
 - "key": "Color",
 - "value": [
 - "Black",
 - "Blue",
 - "Teal"
 - ]
 - },
 - {
 - "key": "Type",
 - "value": [
 - "Autoclavable"
 - ]
 - },
 - {
 - "key": "Amount of Holes",
 - "value": [
 - "10",
 - "15",
 - "27"
 - ]
 - },
 - {
 - "key": "Hole Configuration",
 - "value": [
 - "FG",
 - "FG/Latch",
 - "Latch"
 - ]
 - },
 - {
 - "key": "Manufacturer",
 - "value": "Kerr Rotary"
 - },
 - {
 - "key": "Subcategory",
 - "value": "Bur Blocks"
 - }
 - ],
 - "prodno": [
 - "9590062",
 - "9590066",
 - "9590070",
 - "9590064",
 - "9590078",
 - "9590082",
 - "9590050"
 - ]
 - }'
 - curl -XPUT 'http://localhost:9200/test_attribs/prodgroup_with_attribs/WEBC2590?pretty' -d '{
 - "attributes": [
 - {
 - "key": "Color",
 - "value": [
 - "Black",
 - "Blue",
 - "Teal"
 - ]
 - },
 - {
 - "key": "Type",
 - "value": [
 - "Autoclavable"
 - ]
 - },
 - {
 - "key": "Amount of Holes",
 - "value": [
 - "10",
 - "15",
 - "27"
 - ]
 - },
 - {
 - "key": "Hole Configuration",
 - "value": [
 - "FG",
 - "FG/Latch",
 - "Latch"
 - ]
 - },
 - {
 - "key": "Manufacturer",
 - "value": "Kerr Rotary"
 - },
 - {
 - "key": "Subcategory",
 - "value": "Bur Blocks"
 - }
 - ],
 - "prodno": [
 - "9593718"
 - ]
 - }'
 - curl -XPUT 'http://localhost:9200/test_attribs/prodgroup_with_attribs/WEBC2590?pretty' -d '{
 - "attributes": [
 - {
 - "key": "Color",
 - "value": [
 - "Black",
 - "Blue",
 - "Teal"
 - ]
 - },
 - {
 - "key": "Type",
 - "value": [
 - "Autoclavable"
 - ]
 - },
 - {
 - "key": "Amount of Holes",
 - "value": [
 - "10",
 - "15",
 - "27"
 - ]
 - },
 - {
 - "key": "Hole Configuration",
 - "value": [
 - "FG",
 - "FG/Latch",
 - "Latch"
 - ]
 - },
 - {
 - "key": "Manufacturer",
 - "value": "Kerr Rotary"
 - },
 - {
 - "key": "Subcategory",
 - "value": "Bur Blocks"
 - }
 - ],
 - "prodno": [
 - "8901086"
 - ]
 - }'
 - curl -XPUT 'http://localhost:9200/test_attribs/prodgroup_with_attribs/WEBC2590?pretty' -d '{
 - "attributes": [
 - {
 - "key": "Color",
 - "value": [
 - "Black",
 - "Blue",
 - "Teal"
 - ]
 - },
 - {
 - "key": "Type",
 - "value": [
 - "Autoclavable"
 - ]
 - },
 - {
 - "key": "Amount of Holes",
 - "value": [
 - "10",
 - "15",
 - "27"
 - ]
 - },
 - {
 - "key": "Hole Configuration",
 - "value": [
 - "FG",
 - "FG/Latch",
 - "Latch"
 - ]
 - },
 - {
 - "key": "Manufacturer",
 - "value": "Kerr Rotary"
 - },
 - {
 - "key": "Subcategory",
 - "value": "Bur Blocks"
 - }
 - ],
 - "prodno": [
 - "8901090"
 - ]
 - }'
 - curl -XGET 'http://localhost:9200/prodgroups_with_attribs/prodgroup_with_attribs/_search?pretty' -d '{
 - "query": {
 - "filtered": {
 - "filter": {
 - "nested": {
 - "filter": {
 - "bool": {
 - "must": [
 - {
 - "bool": {
 - "must": [
 - {
 - "term": {
 - "attributes.key": "Color"
 - }
 - },
 - {
 - "terms": {
 - "attributes.value": [
 - "Blue"
 - ]
 - }
 - }
 - ]
 - }
 - }
 - ]
 - }
 - },
 - "path": "attributes"
 - }
 - },
 - "query": {
 - "multi_match": {
 - "fields": [
 - "_all"
 - ],
 - "query": "bur"
 - }
 - }
 - }
 - },
 - "size": 20
 - }'
 - curl -XGET 'http://localhost:9200/prodgroups_with_attribs/prodgroup_with_attribs/_search?pretty' -d '{
 - "query": {
 - "filtered": {
 - "filter": {
 - "nested": {
 - "filter": {
 - "bool": {
 - "must": [
 - {
 - "bool": {
 - "must": [
 - {
 - "term": {
 - "attributes.key": "Type"
 - }
 - },
 - {
 - "terms": {
 - "attributes.value": [
 - "Autoclavable"
 - ]
 - }
 - }
 - ]
 - }
 - }
 - ]
 - }
 - },
 - "path": "attributes"
 - }
 - },
 - "query": {
 - "multi_match": {
 - "fields": [
 - "_all"
 - ],
 - "query": "bur"
 - }
 - }
 - }
 - },
 - "size": 20
 - }'
 - curl -XGET 'http://localhost:9200/prodgroups_with_attribs/prodgroup_with_attribs/_search?pretty' -d '{
 - "query": {
 - "filtered": {
 - "filter": {
 - "nested": {
 - "filter": {
 - "bool": {
 - "must": [
 - {
 - "bool": {
 - "must": [
 - {
 - "term": {
 - "attributes.key": "Color"
 - }
 - },
 - {
 - "terms": {
 - "attributes.value": [
 - "Blue"
 - ]
 - }
 - }
 - ]
 - }
 - },
 - {
 - "bool": {
 - "must": [
 - {
 - "term": {
 - "attributes.key": "Type"
 - }
 - },
 - {
 - "terms": {
 - "attributes.value": [
 - "Autoclavable"
 - ]
 - }
 - }
 - ]
 - }
 - }
 - ]
 - }
 - },
 - "path": "attributes"
 - }
 - },
 - "query": {
 - "multi_match": {
 - "fields": [
 - "_all"
 - ],
 - "query": "bur"
 - }
 - }
 - }
 - },
 - "size": 20
 - }'
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment