last day (14 days later) » 

3:40 AM
0
Q: Elasticsearch - Can't search using suggestion field ("is not a completion suggest field")

maxpleIn elastic search I'm storing records in the trends namespace and trend topic. These are simple objects with only a name (string) and id. I want to search by name via autocomplete, and for that I'm trying to use the indexed search. Here's my code to add the index to the name column. Here I'm us...

 
Can you please post mappin you have right now ?
N you are not, its code which puts mapping. Open in browser SERVER:9200/trends/_mapping?pretty
 
@VolodymyrBilyachat see update
 
do you see that mapping is wrong? As i said in my answer delete INDEX, then make sure index is created, then start indexing your data
I am not sure how ruby works maybe its async so you could sent two requests at the same time.
 
I'm not understanding what you're asking me to do. I already am running DELETE /* which should destroy the mapping I think. Then I create it using the ruby command I show.
 
I am not asking you anything i am just trying to help you. MApping you have posted is wrong "name_suggest": { "type": "text",
 
3:40 AM
@VolodymyrBilyachat I know, i appreciate you. The thing is I am saying name_suggest: {type: "completion"} when i create the mapping, so I don't know why it's being incorrect
 
This is why i am telling you to see do all step by step
so
 
hi
 
1. Delete index and make sure it was deleted localhost:9200/trends/_mapping?pretty
it must tell you 404
 
hmm i did that and it said "no index"
 
perfect
then second step
put mapping
and nothing else
then get mapping localhost:9200/trends/_mapping?pretty
 
3:42 AM
what about create data?
 
no data yet
 
right now i combined them into one step
is that ok?
 
ok..
 
\this actually could be problem
 
3:42 AM
1 sec then
 
i dont know ruby but your current problem is wrong mapping
 
yeah
 
which means that its somewhere when you create and index
ruby could do requests asynchroniously
do you know what it means?
 
i know what async is
the mapping is still wrong
 
so after you put mapping and nothing else?
mapping is wrong?
 
3:44 AM
I am using a pretty abstracted library to do the HTTP, I don't know how it's doing it
I'm using one command as I showed inthe question
it's a variation on INDEX
with body: mappings
extactly after put mapping it's wrong
 
can you post it?
 
I suppose I can try curl, that would be really annoying if the ruby client is buggy
 
here
what librarry you are using?
 
elasticsearch-ruby
it's by elastic team
 
I see what is wrong
elasticsearch.index({ it means that you are indexing data
and not creating index
 
3:46 AM
oh
hmm it's kinda wierd as well, there's another project with the same name on rubygems
i hope im not loading the wrong version
let me try loading from git
 
oh, thanks
 
Yes because mapping was weird :)
 
should I be using document: in the mapping?
 
Yes
this is probably way how they are doing mapping
 
3:58 AM
it's not working still
  def self.index_column_mappings
    elasticsearch.create({
      index: "trends",
      type: "trend",
      id: 0,
      body: {
        mappings: {
          trend: {
            properties: {
              name: {
                type: 'multi_field',
                fields: {
                  name:  { type: 'string' },
                  name_suggest:  { type: 'completion' },
                }
              }
            }
          }
        }
      }
    })
  end
 
its wronbg :)
one sec
def self.index_column_mappings
client.indices.create({
index: "trends",
body: {
mappings: {
trend: {
properties: {
name: { type: 'string' },
name_suggest: { type: 'completion' }
}
}
}
}
})
end
try this
 
Thank you!
it works
 
i have updated answe r;)
 
Maybe it would have been better to just use curl after all
This ruby api is probably just making things more difficult
but i guess i'll stick with it
 
its ok to use ruby the only think you should be careful what you are running. you runned wrong methods
 
4:04 AM
true. I will be testing things before it goes live though
just in time, i have to head out
but thanks again
 

last day (14 days later) »