Created
April 19, 2013 13:01
-
-
Save jippeholwerda/5420204 to your computer and use it in GitHub Desktop.
ElasticSearch sorting on not_analyzed field defined for multiple index types.
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
curl -XPUT http://localhost:9200/test | |
curl -XPUT http://localhost:9200/test/test1/_mapping -d '{ | |
"test1": { | |
"dynamic": "strict", | |
"properties": { | |
"name": { | |
"type": "string", | |
"index": "not_analyzed" | |
} | |
} | |
} | |
}' | |
curl -XPUT http://localhost:9200/test/test2/_mapping -d '{ | |
"test2": { | |
"dynamic": "strict", | |
"properties": { | |
"name": { | |
"type": "string", | |
"index": "not_analyzed" | |
} | |
} | |
} | |
}' | |
curl -XPUT http://localhost:9200/test/test1/id1 -d '{ "name": "A" }' | |
curl -XPUT http://localhost:9200/test/test1/id2 -d '{ "name": "B" }' | |
curl -XPUT http://localhost:9200/test/test2/id3 -d '{ "name": "A" }' | |
curl -XPUT http://localhost:9200/test/test2/id4 -d '{ "name": ["A", "B"] }' | |
curl -XGET http://localhost:9200/test/_search -d '{ | |
"filter": { | |
"and": [ | |
{ "type": { "value": "test2" } }, | |
{ "term": { "name": "A" } } | |
] | |
}, | |
"sort": [ { "name": "asc" } ] | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment