elasticsearch


How to search using keyword analyzer on Elastic Search?


I have problems setting up Elastic Search with Tire and keyword type analyzer.
My mapping definition is this:
Tire.index 'my_index' do
delete
create :mappings => {
"my_type" => {
:properties => {
:id => { :type => 'string', :index => 'not_analyzed', :include_in_all => false },
:user_id => { :type => 'string', :index => 'not_analyzed'},
:team_id => { :type => 'string', :index => 'not_analyzed', :analyzer => 'keyword'},
"_timestamp" => { :enabled => true, :path => "created_on"}
}
}
}
end
I add some data with
team:id: "blah-blih-bloh"
If I search
curl -XGET 'http://localhost:9200/my_index/my_type/_search?q=team_id:blah'
I can found the data I inserted, also if the analyzer was "keyword".
I would like to user facets to group data for team_id, but given that it seems that the keyword analyzer is not working as expected, I cannot retrieve good results because it tokenizes the "team_id" field.
If I have two users with team_id = "blah-blih-bloh", I would get 2 results for "blah", 2 for "blih", 2 for "bloh" and 2 for "blah-blih-bloh".
Do I miss something?
EDIT: I solved the problem, it was Tyre-related. Tyre was not correctly destroyng and recreating the index, if I did
curl -XDELETE
on the index of ElasticSearch, and then I executed the same code as before, mappings were created correctly, data were inserted fine and everything worked as expected.

Related Links

How to configure the publish address of elasticsearch 5.0 with CLI flags?
How to limit ngram tokenzier to first few characters to make it behave like sliding edgeNgram?
nest : how do an index mapping by passing a raw request?
Grafana cannot aggregate on String fields as it does not recognize keyword field in Elasticsearch
Using text field for aggregations in Elasticsearch
Elastic search + LogStash cannot connect
How to allow external connection to elastic search on GCE instance
Elasticserach filter on aggregated results (SQL HAVING)
elasticsearch _update_by_query doesn't work
Nested count queries
Exception thrown when starting Elastic search with X-pack
Should I include data nodes in discovery.zen.ping.unicast.hosts?
Kinesis input stream into Logstash
Unknown issue in Nutch elastic indexing
my elastic search query is matching videos it is not supposed to be [duplicate]
logstach kafka input decode __consumer_offsets message

Categories

HOME
flask
mpdf
facebook-messenger
yii
xcode8.1
bokeh
transactions
ews
visual-studio-2010
vue-resource
amp
elk-stack
ipv6
javafx-8
cdi
minecraft
telegraf
swarm
xades4j
getopenfilename
parsley.js
watch-os-3
phpstorm-2017.1
documentum
chromecast
orc
pickle
tfsbuild
codefluent
renderscript
parceler
adobe-illustrator
wsf
spyder
weex
backendless
function-points
react-bootstrap-table
jsonresult
google-play-developer-api
xenapp
publishing
polyml
buildforge
transform
orchardcms-1.8
cordys-opentext
cartopy
ng-repeat
grails-spring-security
angular-datatables
julius-speech
intellij-lombok-plugin
image-registration
line-intersection
pen
word-2007
emacs25
e
mathjs
livereload
xcode8-beta4
adp
frame-grab
godeps
miniconda
relational-model
console.log
html-escape-characters
jolie
inputbox
angular-ui-select
libgcc
lumia-imaging-sdk
refit
ivalueconverter
ctp
saga
rautomation
apportable
jacob
rikulo
asp.net-mvc-3-areas
2d-vector
xalan
android-dialog
telerik-ajax
system-information
first-class
zotonic
platform-independent
algol68
uploading
glx
fbml
getopts
3des
printqueue
channelfactory
regression-testing
solandra
cleartype
powergui
wmd-editor
jquery-effects
inversion
service-factory
webclient.uploaddata

Resources

Encrypt Message