Inconsistent Results from Index


(Rob White) #1

I have two search indexes, to the best of my understanding these indexes have an identical setup, apart from their name. One index has ~1.7 million documents, the other has 8.

The documents have the following structure (this example exists in both indexes):

{
    _index: "locations",
    _type: "location",
    _id: "Royal Leamington Spa",
    _version: 1,
    found: true,
    _source: {
        name: "Royal Leamington Spa",
        coordinate: {
            lat: 52.29156048773691,
            lon: -1.5343337101975745
        }
    }
}

Both indexes have the same mapping of

<indexname>: {
    settings: {
        index: {
            creation_date: "1427477291143",
            uuid: "Z75-HWNGQwiE0MzqezVctQ",
            number_of_replicas: "1",
            number_of_shards: "1",
            version: {
                created: "1040499" //this is slightly different on each
            }
        }
    }
}

I am querying both with the following:

POST http://<server>/locations/location/_search
{
    "from": 0,
    "size": 10,
    "sort": [
    {
        "_score": {}
    }
    ],
    "query": {
        "match": {
            "name": {
                "type": "phrase_prefix",
                "query": "Royal L"
            }
        }
    }
}

The larger of the two indexes returns no results, but the smaller index returns the document I was expecting. What causes the difference in the result and how can I query the larger index in a way that will return results for the given query?


(Camilo Sierra) #2

are you already compare the mapping for both index after your indexation? the number of documents can't be the problem! can you show us the mapping for this index ?

https://www.elastic.co/guide/en/elasticsearch/reference/1.3/indices-get-mapping.html


(Rob White) #3

The two indexes looks like this, it might be worth noting they are on the same cluster:

GET /locations/_mapping/location

gives me

{
    locations: {
        mappings: {
            location: {
                properties: {
                    coordinate: {
                        type: "geo_point"
                    },
                    name: {
                        type: "string"
                    }
                }
            }
        }
    }
}

and

GET /searchtestlocations/_mapping/location

gives me

{
    searchtestlocations: {
        mappings: {
            location: {
                properties: {
                    coordinate: {
                        type: "geo_point"
                    },
                    name: {
                        type: "string"
                    }
                }
           }
        }
    }
}

It is possible that there is a server wide config which I'm not accounting for? If so what might I go looking for?


(Camilo Sierra) #4

your type is not the same in both index, are you sure that you change your index type ?

POST http://<server>/locations/location/_search
and in the other server :
POST http://<server>/searchtestlocations/location/_search


(Rob White) #5

Yes, I definitely change the type.

I don't know if this is relevant, but for short entries in the index I am able to find data in the larger index. For example postcodes, if I search for "RH12 5" I am presented with all the related postcodes, which is exactly the behaviour I'm expecting. For some reason this doesn't work for longer place names.


(system) #6