Skip to content

Instantly share code, notes, and snippets.

@edwardsmit
Last active September 23, 2015 13:32

Revisions

  1. Edward Smit revised this gist Sep 23, 2015. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions highlightproblem.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    #!/usr/bin/env bash

    curl -XPUT 'localhost:9200/highlightproblem'
    curl -XDELETE 'localhost:9200/highlightproblem'; echo
    curl -XPUT 'localhost:9200/highlightproblem'; echo
    curl -XPUT 'localhost:9200/highlightproblem/highlightproblem/_mapping' -d '{
    "highlightproblem": {
    "properties": {
    @@ -14,24 +15,24 @@ curl -XPUT 'localhost:9200/highlightproblem/highlightproblem/_mapping' -d '{
    }
    }
    }
    }'
    }'; echo
    curl -XPUT 'localhost:9200/highlightproblem/highlightproblem/1' -d '{
    "title": "Highlight title",
    "body": "Highlight singular body"
    }'
    }'; echo
    curl -XPUT 'localhost:9200/highlightproblem/highlightproblem/2' -d '{
    "title": "Highlight title",
    "body": ["array body", "array body 2"]
    }'
    }'; echo
    curl -XPUT 'localhost:9200/highlightproblem/highlightproblem/3' -d '{
    "title": "Highlight title",
    "body": "Singular body"
    }'
    }'; echo
    curl -XPUT 'localhost:9200/highlightproblem/highlightproblem/4' -d '{
    "title": "Highlight title",
    "body": ["highlight array body", "array body 2"]
    }'
    curl -XPOST 'http://localhost:9200/highlightproblem/_refresh'
    }'; echo
    curl -XPOST 'http://localhost:9200/highlightproblem/_refresh'; echo
    curl -XPOST 'http://localhost:9200/highlightproblem/_search?pretty' -d '{
    "query": {
    "match": {
    @@ -48,5 +49,4 @@ curl -XPOST 'http://localhost:9200/highlightproblem/_search?pretty' -d '{
    }
    }
    }'
    echo "Observe the missing highlight-field containing the no_match contents for #id 2"
    curl -XDELETE 'localhost:9200/highlightproblem'
    echo "Observe the missing highlight-field containing the no_match contents for #id 2"
  2. Edward Smit created this gist Sep 23, 2015.
    52 changes: 52 additions & 0 deletions highlightproblem.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    #!/usr/bin/env bash

    curl -XPUT 'localhost:9200/highlightproblem'
    curl -XPUT 'localhost:9200/highlightproblem/highlightproblem/_mapping' -d '{
    "highlightproblem": {
    "properties": {
    "title": {
    "type": "string",
    "term_vector": "with_positions_offsets"
    },
    "body": {
    "type": "string",
    "term_vector": "with_positions_offsets"
    }
    }
    }
    }'
    curl -XPUT 'localhost:9200/highlightproblem/highlightproblem/1' -d '{
    "title": "Highlight title",
    "body": "Highlight singular body"
    }'
    curl -XPUT 'localhost:9200/highlightproblem/highlightproblem/2' -d '{
    "title": "Highlight title",
    "body": ["array body", "array body 2"]
    }'
    curl -XPUT 'localhost:9200/highlightproblem/highlightproblem/3' -d '{
    "title": "Highlight title",
    "body": "Singular body"
    }'
    curl -XPUT 'localhost:9200/highlightproblem/highlightproblem/4' -d '{
    "title": "Highlight title",
    "body": ["highlight array body", "array body 2"]
    }'
    curl -XPOST 'http://localhost:9200/highlightproblem/_refresh'
    curl -XPOST 'http://localhost:9200/highlightproblem/_search?pretty' -d '{
    "query": {
    "match": {
    "_all": "highlight"
    }
    },
    "highlight": {
    "fields": {
    "body": {
    "fragment_size": 100,
    "number_of_fragments": 2,
    "no_match_size": 100
    }
    }
    }
    }'
    echo "Observe the missing highlight-field containing the no_match contents for #id 2"
    curl -XDELETE 'localhost:9200/highlightproblem'