Updating document mapping without re-indexing

(banupriya) #1

I am trying to add copy_to for the existing index. For Ex:

PUT /my_index

{ "mappings":{ "my_type":{ "properties":{ "user_name":{ "type":"string", "copy_to":["key"], "index":"not_analyzed", "include_in_all":false } } }, "key":{ "type":"string", "store":"yes" } } }

I have the data already in the user_name. When updating the mapping will these data gets copied to the copy_to field ? When i index new set of inputs will the new inputs only gets copied to the copy_to (key) field ? Or do we need to do re-index to get the changes reflected ? How to update copy to without re-indexing the whole document or can we update only the specific user_name document to get the changes reflected ?

(Mark Walkom) #2

No, only new data.

You need to reindex, or just issue a update to the existing docs.

(banupriya) #3

updating existing docs means ?

(Mark Walkom) #4

Make a change to it.

(banupriya) #5

Do we need to update the existing documents values. Any API update you are mentioning ?

(banupriya) #6

could you please explain me clearly

(David Pilato) #7

If you have indexed:

PUT my_index/my_type/1
  "user_name": "bar"

Then send again:

PUT my_index/my_type/1
  "user_name": "bar"

Your document 1 will have its field copied to key field.

(banupriya) #8

you mean we need to re index that specific document where we are using copy_to
without re indexing we cannot update the copy_to field?

(David Pilato) #9

Yes that's what @warkolm and I are saying.

(banupriya) #10

Okay Thanks for your help !

(banupriya) #11

i have another question. Can you please help on this
I have 200K records and trying to fetch records based on certain match criteria ex: company_name: "test" If i give size:250 expecting record is not available in search results. size:500 the expecting document is fetched and displayed. How to get the document in top 25 results ?

Query : {"explain":true,"size":250,"query":{"query_string":{"query":" ( (NAME:"BANK AMERICA")^50 OR (ceoNames.fullCEOName:(BANK AMERICA))^30 OR (NAME_PAIR:"BANK AMERICA")^30 OR (NORMAL_NAME:(BANK AMERICA) AND CITY:"" ) ^40 OR (NORMAL_NAME:(BANK AMERICA))^30 OR (tradeStyles.acronym:"BS")^5 OR (NORMAL_NAME_SOUNDEX:"BANK AMERICA")^5 OR (address.streetName:"" AND CITY:"")^30 OR (ZIP:"")^6 OR (address.streetName:"")^6 OR (address.streetNumber:"" AND address.streetName:"")^15 OR (telephones.telephone:"")^50 OR (mailAddresses.postbox:"")^6 ) "}},"sort":[{"_score":{"order":"desc"}},{"statusIndicator":{"order":"asc"}}],"aggs":{"NAME":{"filter":{"term":{"NAME":"ATLS"}}}}}

I have a field 'max_docs' based on that field i need to get the results. How to multiply max_docs with the _score field ?

(David Pilato) #12

Please create a new thread for that and format your code using </> icon. It will make your post more readable.

(banupriya) #13

I have already created a post but not getting any response. Please find the link Elasticsearch query retrieve fetch expecting result in top 25 results

(David Pilato) #14

Edit your question, format your code there and be patient.

(system) #15