Created
December 9, 2013 11:12
-
-
Save nkvoll/7870684 to your computer and use it in GitHub Desktop.
This file contains 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
analyzer: | |
casesensitive: | |
type: custom | |
tokenizer: standard | |
filter: [standard, stop] |
This file contains 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
title: Metastatic Lung Cancer | |
tags: | |
- MET | |
- Lung | |
- HGF | |
--- | |
title: "Colorectal kras c.12345G>T" | |
tags: | |
- PTEN Loss | |
- colorectal | |
- KRAS | |
--- | |
title: Colorectal Kras | |
tags: | |
- colorectal | |
- "KRAS c.12345G>T" |
This file contains 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
test: | |
properties: | |
title: | |
type: multi_field | |
fields: | |
title: | |
type: string | |
title.cased: | |
type: string | |
analyzer: casesensitive | |
tags: | |
type: multi_field | |
fields: | |
tags: | |
type: string | |
tags.cased: | |
type: string | |
analyzer: casesensitive |
This file contains 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
#!/bin/bash | |
export ELASTICSEARCH_ENDPOINT="http://localhost:9200" | |
# Create indexes | |
curl -XPUT "$ELASTICSEARCH_ENDPOINT/play" -d '{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"casesensitive": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": [ | |
"standard", | |
"stop" | |
] | |
} | |
} | |
} | |
}, | |
"mappings": { | |
"test": { | |
"properties": { | |
"title": { | |
"type": "multi_field", | |
"fields": { | |
"title": { | |
"type": "string" | |
}, | |
"title.cased": { | |
"type": "string", | |
"analyzer": "casesensitive" | |
} | |
} | |
}, | |
"tags": { | |
"type": "multi_field", | |
"fields": { | |
"tags": { | |
"type": "string" | |
}, | |
"tags.cased": { | |
"type": "string", | |
"analyzer": "casesensitive" | |
} | |
} | |
} | |
} | |
} | |
} | |
}' | |
# Index documents | |
curl -XPOST "$ELASTICSEARCH_ENDPOINT/_bulk?refresh=true" -d ' | |
{"index":{"_index":"play","_type":"type"}} | |
{"title":"Metastatic Lung Cancer","tags":["MET","Lung","HGF"]} | |
{"index":{"_index":"play","_type":"type"}} | |
{"title":"Colorectal kras c.12345G>T","tags":["PTEN Loss","colorectal","KRAS"]} | |
{"index":{"_index":"play","_type":"type"}} | |
{"title":"Colorectal Kras","tags":["colorectal","KRAS c.12345G>T"]} | |
' | |
# Do searches | |
curl -XPOST "$ELASTICSEARCH_ENDPOINT/_search?pretty" -d ' | |
{ | |
"filter": { | |
"query": { | |
"multi_match": { | |
"fields": [ | |
"title", | |
"tags" | |
], | |
"query": "met", | |
"type": "phrase", | |
"analyzer": "casesensitive" | |
} | |
} | |
} | |
} | |
' | |
curl -XPOST "$ELASTICSEARCH_ENDPOINT/_search?pretty" -d ' | |
{ | |
"filter": { | |
"query": { | |
"multi_match": { | |
"fields": [ | |
"title", | |
"tags" | |
], | |
"query": "MET", | |
"type": "phrase", | |
"analyzer": "casesensitive" | |
} | |
} | |
} | |
} | |
' | |
curl -XPOST "$ELASTICSEARCH_ENDPOINT/_search?pretty" -d ' | |
{ | |
"filter": { | |
"query": { | |
"multi_match": { | |
"fields": [ | |
"title.cased", | |
"tags.cased" | |
], | |
"query": "met", | |
"type": "phrase", | |
"analyzer": "casesensitive" | |
} | |
} | |
} | |
} | |
' | |
This file contains 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
# Auto generated by Found's Play-tool at 2013-12-09T12:15:50+01:00 | |
version: 0 | |
title: "Multi-match case sensitive analyzer" | |
description: "" |
This file contains 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
filter: | |
query: | |
multi_match: | |
fields: [title, tags] | |
query: met | |
type: phrase | |
analyzer: casesensitive | |
--- | |
filter: | |
query: | |
multi_match: | |
fields: [title, tags] | |
query: MET | |
type: phrase | |
analyzer: casesensitive | |
--- | |
filter: | |
query: | |
multi_match: | |
fields: [title.cased, tags.cased] | |
query: met | |
type: phrase | |
analyzer: casesensitive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment