Pauli Østerø
Pauli Østerø

Reputation: 6916

Field being ignored when querying

I have the following document

{ 
  "authors" : "Nanna Friis",
  "authorsId" : [ "4642" ],
  "description" : "Med denne praktiske og pædagogiske håndbog kommer du hele vejen     rundt om at skrive godt til nettet. Du bliver taget ved hånden og får en grundig gennemgang af de helt særlige præmisser, der hersker på nettet. ",
  "iSBN" : "9788762904118",
  "mediaType" : "10",
  "name" : "Kort, klart og klikbart",
  "nameSort" : "Kort, klart og klikbart",
  "price" : 250.0,
  "productId" : "9788762904118",
  "publicationAreaCode" : "3077",
  "tags" : [  ],
  "titleId" : "25004"
}

When doing a query like this http://localhost:9200/titles/_search?q=Nanna* i don't get any results. If i instead query on ie. the productId like this http://localhost:9200/titles/_search?q=9788762904118 im getting the document in question.

What is going on?

Upvotes: 0

Views: 64

Answers (1)

Ion Cojocaru
Ion Cojocaru

Reputation: 2583

you do not specify the query field in the request

in such case you will search the Default Search Field

When not explicitly specifying the field to search on in the query string syntax, the index.query.default_field will be used to derive which field to search on. It defaults to _all field.

So, if _all field is disabled, it might make sense to change it to set a different default field.

Upvotes: 1

Related Questions