backslash17
backslash17

Reputation: 5390

NEST Elasticsearch empty response when I add a query to a field

I´m working in elasticsearch with NEST and with an index of theaters and I'm having strange issue when creating a query that respond perfectly to MatchAll() but not returns any match with a the specific Match in the example:

    var searchResponse = client.Search<ElasticTheater>(
        s => s
        .Query(q => q
                .Match(m => m
                    .Field(f => f.TheatreName())
                    .Query("U")
                    )
         )
        .Index("theaters")
        .Type("")
        .Pretty(true)

    );

}

If I change the value "U" in the query for an empty string like "", the query returns all data again.

¿Any idea? Thanks a lot in advance.

Upvotes: 0

Views: 372

Answers (1)

backslash17
backslash17

Reputation: 5390

The query was not responding because the name of the property in the class ElasticTheater was in CamelCase and in the elasticsearch index was all in lowercase. The names in the elasticsearch were created by logstash changing the database ones in SQL. The final name into the query was f.theatername

Upvotes: 1

Related Questions