Skip to content

Instantly share code, notes, and snippets.

@imotov
Created October 7, 2011 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imotov/1270503 to your computer and use it in GitHub Desktop.
Save imotov/1270503 to your computer and use it in GitHub Desktop.
Elasticsearch NPE during highlighting
#!/bin/sh
#
# Start 2 ES nodes with default settings before running this script
#
curl -XDELETE http://localhost:9200/testidx
curl -XPUT http://localhost:9200/testidx -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
},
"mappings" : {
"rec" : {
"_source" : { "enabled" : false },
"properties" : {
"from" : { "type": "string", "store": "yes" }
}
}
}
}'
curl -XPUT http://localhost:9200/testidx/rec/1 -d '{
"from" : ["user3@test.com","user2@test.com","user5@test.com"]
}'
echo
curl -XPOST http://localhost:9200/testidx/_refresh
echo
curl localhost:9200/testidx/_search -d '{
"highlight": {
"fields":{"from":{"number_of_fragments":0}}
},
"fields":["*"],
"size":10,
"sort":["_score"],
"query":{
"query_string":{
"default_field":"from",
"query":"*:*"
}
}
}' && echo
curl localhost:9201/testidx/_search -d '{
"highlight": {
"fields":{"from":{"number_of_fragments":0}}
},
"fields":["*"],
"size":10,
"sort":["_score"],
"query":{
"query_string":{
"default_field":"from",
"query":"*:*"
}
}
}' && echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment