You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by tuxedomoon <da...@yahoo.com> on 2015/05/21 00:43:48 UTC
Reindex of document leaves old fields behind
I'm reindexing Mongo docs into SolrCloud. The new docs have had a few fields
removed so upon reindexing those fields should be gone in Solr. They are
not. So the result is a new doc merged with an old doc rather than a
replacement which is what I need.
I do not know whether the issue is with my SolrJ client, Solr config or
something else.
--
View this message in context: http://lucene.472066.n3.nabble.com/Reindex-of-document-leaves-old-fields-behind-tp4206710.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reindex of document leaves old fields behind
Posted by tuxedomoon <da...@yahoo.com>.
This is fixed. My SolrJ client was putting a JSON object into a multivalued
field in the SolrInputDocument. Solr returned a 0 status code but did not
add the bad object, instead it performed what looks like an atomic index as
described above. Once I removed the illegal JSON object from the
SolrInputDocument a regular document replacement occurred and my unwanted
fields were removed in Solr.
Is this a known behaviour, for Solr to switch into atomic update mode based
on attributes of the SolrInputDocument?
--
View this message in context: http://lucene.472066.n3.nabble.com/Reindex-of-document-leaves-old-fields-behind-tp4206710p4207164.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reindex of document leaves old fields behind
Posted by tuxedomoon <da...@yahoo.com>.
I'm posting the fields from one of my problem document, based on this comment
I found from Shawn on Grokbase.
>> If you are trying to use a Map object as the value of a field, that is
>> probably why it is interpreting your add request as an atomic update.
>> If this is the case, and you're doing it because you have a multivalued
>> field, you can use a List object rather than a Map.
This is just a solrDoc.toString() with linebreaks where commas were. Maybe
some of these are being seen as map fields by SOLR.
=========================================================================
SolrInputDocument[
mynamespaces_s_mv=[drama],
changedates_s_mv=[Tue May 19 17:21:26 EDT 2015, Thu Dec 30 19:00:00 EST
9999],
networks_t_mv=[{ "abcitem-id" : "288578fd-6596-47bc-af95-80daecd1f24a" ,
"abccontentType" : "Standard:SocialHandle" , "SocialNetwork" : { "$uuid" :
"73553c4c-4919-4ba9-b16c-fb340f3e4c31"} , "Handle" : "in my
imaginationseries"}],
links_s_mv=[ { "$uuid" : "4d8eb47c-ce2d-4e7f-a567-d8d6692fed4e"} , { "$uuid"
: "9fd75c26-35f2-4f48-b55a-6e82089cc3ba"} , { "$uuid" :
"150e43ed-9ebe-41b4-86cc-bdf4885a50fe"} , { "$uuid" :
"e20b0040-561f-4c34-9dd3-df85250b5a5b"} , { "$uuid" :
"0cff75d0-4f32-46c9-9092-60eec2dc847a"} , { "$uuid" :
"73553c4c-4919-4ba9-b16c-fb340f3e4c31"}],
ratings_t_mv=[{ "abcitem-id" : "56058649-579a-4160-9439-e59448eb3dff" ,
"abccontentType" : "Standard:TVPG" , "Rating" : { "$uuid" :
"150e43ed-9ebe-41b4-86cc-bdf4885a50fe"}}],
title_ci_t=in my imagination,
urlkey_s=in-my imagination,
title_cs_t=In My Imagination,
dp2_1_s_mv=[ { "_id" : { "$uuid" : "4d8eb47c-ce2d-4e7f-a567-d8d6692fed4e"} ,
"_rules" : [ { "_startDate" : { "$date" : "2015-03-23T14:58:00.000Z"} ,
"_endDate" : { "$date" : "9999-12-31T00:00:00.000Z"} , "_r" : { "$uuid" :
"47b6b31d-d690-437a-9bab-6eeb7be3c8a4"} , "_p" : { "$uuid" :
"d478874f-8fc7-4b3d-97f3-f7e63222d633"} , "_o" : { "$uuid" :
"983b6ae9-7882-4af8-bb2f-cff342be99b3"} , "_a" : null }]}],
seriestype_s=e20b0040-561f-4c34-9dd3-df85250b5a5b,
shortid_s=x5jqqf, i
shorttitle_t=In My Imagination,
uuid_s=90a1fbbf-ddf8-47a7-9f00-55f05e7dc297,
status_s=DEFAULT,
updatedby_s=maceirar,
description_t=sometext,
review_s_mv=[{ "abcpublished" : { "$date" : "2015-05-19T21:21:30.930Z"} ,
"abcpublishedBy" : "jelly" , "abctargetEnvironment" :
"entertainment-staging" , "abcrequestId" : { "$uuid" :
"56769138-4a03-4ed6-8b29-8030d0941b08"} , "abcsourceEnvironment" : "fishing"
, "abcstate" : true}, { "abcpublished" : { "$date" :
"2015-05-19T21:21:31.731Z"} , "abcpublishedBy" : "jelly" ,
"abctargetEnvironment" : "myshow-live" , "abcrequestId" : { "$uuid" :
"56769138-4a03-4ed6-8b29-8030d0941b08"} , "abcsourceEnvironment" :
"myshow-staging" , "abcstate" : true}],
sorttitle_t=In My Imagination,
images_s_mv=[ { "$uuid" : "9fd75c26-35f2-4f48-b55a-6e82089cc3ba"} , {
"$uuid" : "0cff75d0-4f32-46c9-9092-60eec2dc847a"}],
title_ci_s=in my imagination,
firmuuids_s_mv=[ { "$uuid" : "4d8eb47c-ce2d-4e7f-a567-d8d6692fed4e"}],
id=mongo-v2.abcnservices.com-fishing-90a1fbbf-ddf8-47a7-9f00-55f05e7dc297,
timestamp=Thu May 21 17:29:58 EDT 2015
]
--
View this message in context: http://lucene.472066.n3.nabble.com/Reindex-of-document-leaves-old-fields-behind-tp4206710p4206963.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reindex of document leaves old fields behind
Posted by tuxedomoon <da...@yahoo.com>.
a few further clues to this unresolved problem
1. I found one of my 5 zookeeper instances was down
2. I tried another reindex of a bad document but no change on the SOLR side
3. I deleted and reindexed the same doc, that worked (obviously, but at this
point I don't know what to expect)
--
View this message in context: http://lucene.472066.n3.nabble.com/Reindex-of-document-leaves-old-fields-behind-tp4206710p4206946.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reindex of document leaves old fields behind
Posted by tuxedomoon <da...@yahoo.com>.
I'm relying on an autocommit of 60 secs.
I just ran the same test via my SolrJ client and result was the same,
SolrCloud query always returns correct number of fields.
Is there a way to find out which shard and replica a particular document
lives on?
--
View this message in context: http://lucene.472066.n3.nabble.com/Reindex-of-document-leaves-old-fields-behind-tp4206710p4206908.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reindex of document leaves old fields behind
Posted by Erick Erickson <er...@gmail.com>.
My guess is that you're not committing from your SolrJ program. That's
automatic when you post.
Best,
Erick
On Thu, May 21, 2015 at 10:13 AM, tuxedomoon <da...@yahoo.com> wrote:
> OK it is composite
>
> I've just used post.sh to index a test doc with 3 fields to leader 1 of my
> SolrCloud. I then reindexed it with 1 field removed and the query on it
> shows 2 fields. I repeated this a few times and always get the correct
> field count from Solr.
>
> I'm now wondering if SolrJ is somehow involved in performing an atomic
> update rather than replacement. I will try the above test via SolrJ.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Reindex-of-document-leaves-old-fields-behind-tp4206710p4206886.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reindex of document leaves old fields behind
Posted by tuxedomoon <da...@yahoo.com>.
OK it is composite
I've just used post.sh to index a test doc with 3 fields to leader 1 of my
SolrCloud. I then reindexed it with 1 field removed and the query on it
shows 2 fields. I repeated this a few times and always get the correct
field count from Solr.
I'm now wondering if SolrJ is somehow involved in performing an atomic
update rather than replacement. I will try the above test via SolrJ.
--
View this message in context: http://lucene.472066.n3.nabble.com/Reindex-of-document-leaves-old-fields-behind-tp4206710p4206886.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reindex of document leaves old fields behind
Posted by Shawn Heisey <ap...@elyograg.org>.
On 5/21/2015 9:54 AM, tuxedomoon wrote:
> I'm doing all my index to leader 1 and have not specified any router
> configuration. But there is an equal distribution of 240M docs across 5
> shards. I think I've been stating I have 3 shards in these posts, I have 5,
> sorry.
>
> How do I know what kind of routing I am using?
If all your indexing is going to the same place and the docs are
distributed evenly, then quite possibly your router is compositeId.
To see for sure, go to the admin UI, click on Cloud, then Tree. Click
the little arrow next to "collections", then click on the collection
name. In the far right pane, there will be a small snippet of JSON
below the other attributes, defining the configName and router.
Thanks,
Shawn
Re: Reindex of document leaves old fields behind
Posted by tuxedomoon <da...@yahoo.com>.
I'm doing all my index to leader 1 and have not specified any router
configuration. But there is an equal distribution of 240M docs across 5
shards. I think I've been stating I have 3 shards in these posts, I have 5,
sorry.
How do I know what kind of routing I am using?
--
View this message in context: http://lucene.472066.n3.nabble.com/Reindex-of-document-leaves-old-fields-behind-tp4206710p4206869.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reindex of document leaves old fields behind
Posted by Shawn Heisey <ap...@elyograg.org>.
On 5/21/2015 9:02 AM, tuxedomoon wrote:
> l>> If it is "implicit" then
>>> you may have indexed the new document to a different shard, which means
>>> that it is now in your index more than once, and which one gets returned
>>> may not be predictable.
>
> If a document with uniqueKey "1234" is assigned to a shard by SolrCloud,
> implicit routing won't a reindex of "1234" be assigned to the same shard?
> If not you'd have dups all over the cluster.
The "implicit" router basically means manual routing. Whatever shard
actually receives the request will be the one that indexes it.
If you want documents automatically routed according to their hash, you
need the compositeId router.
Thanks,
Shawn
Re: Reindex of document leaves old fields behind
Posted by tuxedomoon <da...@yahoo.com>.
l>> If it is "implicit" then
>> you may have indexed the new document to a different shard, which means
>> that it is now in your index more than once, and which one gets returned
>> may not be predictable.
If a document with uniqueKey "1234" is assigned to a shard by SolrCloud,
implicit routing won't a reindex of "1234" be assigned to the same shard?
If not you'd have dups all over the cluster.
--
View this message in context: http://lucene.472066.n3.nabble.com/Reindex-of-document-leaves-old-fields-behind-tp4206710p4206849.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reindex of document leaves old fields behind
Posted by tuxedomoon <da...@yahoo.com>.
>> let's see the code.
simplified code and some comments
1. solrUrl points at leader 1 of 3 leaders, each with a replica
2. createSolrDoc takes a full Mongo doc and returns a valid
SolrInputDocument
3. I have done dumps of the returned solrDoc and verified it does not have
the unwanted fields
SolrServer solrServer = new HttpSolrServer(solrUrl);
SolrInputDocument solrDoc = solrDocFactory.createSolrDoc(mongoDoc,
dbName);
UpdateResponse uresponse = solrServer.add(solrDoc);
>> issue a query on some of the unique ids in question
SolrCloud is returning only 1 document per uniqueKey
>> Did you push your schema up to Zookeeper and reload
>> (or restart) your collection before re-indexing things?
no. the config was pushed up to Zookeeper only once a few months ago. The
documents in question were updated in Mongo and given an updated
create_date. Based on this new create_date my SolrJ client detects and
reindexes them.
>> are you sure the documents are actually getting indexed and that the
>> update
>> is succeeding?
yes, I see a new value in the timestamp field each time I reindex
--
View this message in context: http://lucene.472066.n3.nabble.com/Reindex-of-document-leaves-old-fields-behind-tp4206710p4206841.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reindex of document leaves old fields behind
Posted by Erick Erickson <er...@gmail.com>.
Well, let's see the code. Standard updates should replace the previous
docs, reindexing the same unique ID with fewer fields should show
fewer fields. So something's weird here.
Although do, just for yucks, issue a query on some of the unique ids
in question, I'd be curious if you get more than one back which would
tell us something.
Did you push your schema up to Zookeeper and reload (or restart) your
collection before re-indexing things? And are you sure the documents
are actually getting indexed and that the update is succeeding? (check
your Solr logs probably here).
Best,
Erick
On Wed, May 20, 2015 at 5:12 PM, tuxedomoon <da...@yahoo.com> wrote:
> The uniqueKey value is the same.
>
> The new documents contain fewer fields than the already indexed ones. Could
> this cause the updates to be treated as atomic? With the persisting fields
> treated as un-updated?
>
> Routing should be implicit since the collection was created using numShards.
> Many request for the same document with cache busting produce the same
> unwanted fields, so I doubt the "correct" one is hiding somewhere. I can
> also see the timestamp going up with each reindex.
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Reindex-of-document-leaves-old-fields-behind-tp4206710p4206732.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reindex of document leaves old fields behind
Posted by tuxedomoon <da...@yahoo.com>.
The uniqueKey value is the same.
The new documents contain fewer fields than the already indexed ones. Could
this cause the updates to be treated as atomic? With the persisting fields
treated as un-updated?
Routing should be implicit since the collection was created using numShards.
Many request for the same document with cache busting produce the same
unwanted fields, so I doubt the "correct" one is hiding somewhere. I can
also see the timestamp going up with each reindex.
--
View this message in context: http://lucene.472066.n3.nabble.com/Reindex-of-document-leaves-old-fields-behind-tp4206710p4206732.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reindex of document leaves old fields behind
Posted by Shawn Heisey <ap...@elyograg.org>.
On 5/20/2015 4:43 PM, tuxedomoon wrote:
> I'm reindexing Mongo docs into SolrCloud. The new docs have had a few fields
> removed so upon reindexing those fields should be gone in Solr. They are
> not. So the result is a new doc merged with an old doc rather than a
> replacement which is what I need.
>
> I do not know whether the issue is with my SolrJ client, Solr config or
> something else.
Do those documents have the same value in the uniqueKey field? It must
be an exact match -- a deviation in upper/lower case will be treated as
a new document.
If they do have identical information in the uniqueKey field, then there
are a few possible problems:
Are you indexing full documents, or are you doing Atomic Updates? An
atomic update is by definition a change, not a replacement ... so unless
that change includes deleting fields, they would not be affected.
https://wiki.apache.org/solr/Atomic_Updates
If your collection has multiple shards, then this paragraph may apply:
What is the router set to on the collection? If it is "implicit" then
you may have indexed the new document to a different shard, which means
that it is now in your index more than once, and which one gets returned
may not be predictable. The same thing may be true if you are using
composite routing and including information in the key that sends the
document to a different shard from where it was originally indexed.
Thanks,
Shawn