Created
July 8, 2011 00:14
-
-
Save anonymous/1070840 to your computer and use it in GitHub Desktop.
curl recreation for queries with multiple colons
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
============================================================================= | |
elasticsearch.yml config | |
index: | |
analysis: | |
analyzer: | |
lcWhitespace: | |
type: custom | |
tokenizer: whitespace | |
filter: [lowercase] | |
curl -XPUT "localhost:9200/pe-test/application/_mapping?pretty=true" -d '{ | |
"application": { | |
"properties": { | |
"className": { | |
"type":"string", | |
"analyzer":"lcWhitespace" | |
} | |
} | |
} | |
}' | |
{ | |
"ok" : true, | |
"acknowledged" : true | |
} | |
============================================================================= | |
curl -XPOST "localhost:9200/pe-test/application/1?pretty=true" -d '{ | |
"className":["blah", "bleep$bloop", "ends:with:colon:", ":starts:with:colon"] | |
}' | |
{ | |
"ok" : true, | |
"_index" : "pe-test", | |
"_type" : "application", | |
"_id" : "1", | |
"_version" : 1 | |
} | |
============================================================================= | |
curl -XGET "localhost:9200/pe-test/application/_search?pretty=true" -d '{ | |
"query": { | |
"field": { | |
"className": "ends:with:colon" | |
} | |
} | |
}' | |
{ | |
"error" : "SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[346WDIOaSWG_S_UbhLh-EA][pe-test][0]: SearchParseException[[pe-test][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\": {\n \"field\": {\n \"className\": \"ends:with:colon\"\n }\n }\n}]]]; nested: QueryParsingException[[pe-test] Failed to parse query [ends:with:colon]]; nested: ParseException[Cannot parse 'ends:with:colon': Encountered \" \":\" \": \"\" at line 1, column 9.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n ]; nested: ParseException[Encountered \" \":\" \": \"\" at line 1, column 9.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n ]; }{[346WDIOaSWG_S_UbhLh-EA][pe-test][1]: SearchParseException[[pe-test][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\": {\n \"field\": {\n \"className\": \"ends:with:colon\"\n }\n }\n}]]]; nested: QueryParsingException[[pe-test] Failed to parse query [ends:with:colon]]; nested: ParseException[Cannot parse 'ends:with:colon': Encountered \" \":\" \": \"\" at line 1, column 9.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n ]; nested: ParseException[Encountered \" \":\" \": \"\" at line 1, column 9.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n ]; }{[346WDIOaSWG_S_UbhLh-EA][pe-test][2]: SearchParseException[[pe-test][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\": {\n \"field\": {\n \"className\": \"ends:with:colon\"\n }\n }\n}]]]; nested: QueryParsingException[[pe-test] Failed to parse query [ends:with:colon]]; nested: ParseException[Cannot parse 'ends:with:colon': Encountered \" \":\" \": \"\" at line 1, column 9.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n ]; nested: ParseException[Encountered \" \":\" \": \"\" at line 1, column 9.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n ]; }{[346WDIOaSWG_S_UbhLh-EA][pe-test][3]: SearchParseException[[pe-test][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\": {\n \"field\": {\n \"className\": \"ends:with:colon\"\n }\n }\n}]]]; nested: QueryParsingException[[pe-test] Failed to parse query [ends:with:colon]]; nested: ParseException[Cannot parse 'ends:with:colon': Encountered \" \":\" \": \"\" at line 1, column 9.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n ]; nested: ParseException[Encountered \" \":\" \": \"\" at line 1, column 9.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n ]; }{[346WDIOaSWG_S_UbhLh-EA][pe-test][4]: SearchParseException[[pe-test][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\": {\n \"field\": {\n \"className\": \"ends:with:colon\"\n }\n }\n}]]]; nested: QueryParsingException[[pe-test] Failed to parse query [ends:with:colon]]; nested: ParseException[Cannot parse 'ends:with:colon': Encountered \" \":\" \": \"\" at line 1, column 9.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n ]; nested: ParseException[Encountered \" \":\" \": \"\" at line 1, column 9.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n ]; }]", | |
"status" : 500 | |
} | |
============================================================================= | |
curl -XGET "localhost:9200/pe-test/application/_search?pretty=true" -d '{ | |
"query": { | |
"field": { | |
"className": "ends:with*" | |
} | |
} | |
}' | |
{ | |
"took" : 1, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 0, | |
"max_score" : null, | |
"hits" : [ ] | |
} | |
} | |
============================================================================= | |
curl -XGET "localhost:9200/pe-test/application/_search?pretty=true" -d '{ | |
"query": { | |
"field": { | |
"className": "ends*" | |
} | |
} | |
}' | |
{ | |
"took" : 2, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 1, | |
"max_score" : 1.0, | |
"hits" : [ { | |
"_index" : "pe-test", | |
"_type" : "application", | |
"_id" : "1", | |
"_score" : 1.0, "_source" : { | |
"className":["blah", "bleep$bloop", "ends:with:colon:", ":starts:with:colon"] | |
} | |
} ] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment