I have attached a short bash script to recreate the situation. I have a fairly simple custom analyzer that I want to break on camel case so lowercase is last. Using the _analyze endpoint I can see the token I am searching for is generated by the analyzer, however searching for it with query_string yields a different result that a term query. I put comments in the script to explain in more detail.
Thanks for any help! #!/bin/sh url="http://localhost:9200" defaultIndex="example" echo "Start over...this will fail the first time the script is run since the index will not exist" curl -XDELETE "$url/$defaultIndex?refresh=true" echo "Create index with custom analyzer" curl -XPUT "$url/$defaultIndex" -d '{ "index": { "analysis": { "filter": { "my_worddelim": { "type": "word_delimiter", "split_on_case_change": true, "preserve_original": true } }, "analyzer": { "my_analyzer": { "type": "custom", "char_filter": [ "html_strip" ], "tokenizer": "keyword", "filter": [ "stop", "my_worddelim", "lowercase" ] } } } } }' echo curl -XPUT "$url/$defaultIndex/example/_mapping" -d '{ "example" : { "properties" : { "name": { "type" : "multi_field", "path": "just_name", "fields" : { "name": { "type": "string", "analyzer": "my_analyzer" }, "sample" : {"type" : "string", "index" : "not_analyzed" }, "sample_name" : {"type" : "string", "analyzer": "my_analyzer" } } } } } }' echo "Shows the lowercase token exampleofbug is generated" curl -XGET "$url/$defaultIndex/_analyze?analyzer=my_analyzer&pretty=true" -d 'ExampleOf Bug' echo "Post the document (haven't tried with non-bulk request)" curl -XPOST "$url/$defaultIndex/example/_bulk?refresh=true" -d ' { "index" : {"_index":"example","_type":"example","_id":"2169167","_version_type":"internal","_timestamp":0} } {"name":"ExampleOf Bug"} ' echo echo "query_string query is unable to find token in the name field even though the path is just_name. i also tried escaping space per documentation and it fails to parse" curl -XPOST "$url/$defaultIndex/example/_search?pretty=true" -d ' { "query": { "query_string": { "query": "name:\"exampleof bug\"" } } } ' echo echo "Can successfully find token in name field that I was unable to find with query_string" curl -XPOST "$url/$defaultIndex/example/_search?pretty=true" -d ' { "query": { "term": { "name": "exampleof bug" } } } ' -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3c98000a-bfaf-4eae-b908-bec71ed18643%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
